Java Integer Mod modulo(int a, int b)

Here you can find the source of modulo(int a, int b)

Description

modulo

License

Open Source License

Declaration

protected static int modulo(int a, int b) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2005, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://from  w ww.  j a  va2  s. c  om
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

public class Main {
    protected static int modulo(int a, int b) {
        return a - fQuotient(a, b) * b;
    }

    protected static int fQuotient(int a, int b) {
        return (int) Math.floor((double) a / (double) b);
    }
}

Related

  1. modularExp(long base, long exp, int modulus)
  2. modularInverses(int p)
  3. modularInvert(int num, int modulus)
  4. modulateCircularIndex(int index, int seqLength)
  5. modulo(int a, int b)
  6. modulo(int dividend, int divisor)
  7. modulo(int x, int m)
  8. modulo(int x, int mod)
  9. modulo(int x, int y)