Java Integer Mod mod(int i, int n)

Here you can find the source of mod(int i, int n)

Description

mod

License

Open Source License

Declaration

private static int mod(int i, int n) 

Method Source Code

//package com.java2s;
/*/*from   ww w . ja va  2  s .  c om*/
 *  Copyright (C) 2008-2009 Piotr Wendykier
 *  Additions (C) 2009 Johan Henriksson
 *  
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    private static int mod(int i, int n) {
        return ((i % n) + n) % n;
    }
}

Related

  1. mod(int a, int b)
  2. mod(int a, int n)
  3. mod(int a, int n)
  4. mod(int divisor, int dividend)
  5. mod(int hash, int size)
  6. mod(int num, int div)
  7. mod(int v, int m)
  8. mod(int x, int y)
  9. mod(int x, int y)