Java Long Number Mod modulo(long a, long n)

Here you can find the source of modulo(long a, long n)

Description

Get the arithmetic modulo.

License

Apache License

Parameter

Parameter Description
a Input operand.
n Modulus.

Return

Value of the modulo.

Declaration

public static long modulo(long a, long n) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**// www .  j a v  a  2  s .co  m
     * Get the arithmetic modulo.
     *
     * @param a Input operand.
     * @param n Modulus.
     * @return Value of the modulo.
     */
    public static long modulo(long a, long n) {
        while (a < 0)
            a += n;
        return a % n;
    }
}

Related

  1. modifiedCalcElementOffset(long index, long mask)
  2. modifyValue(long value, char op, long modifier, long max, long min)
  3. mods(long v, long m)
  4. modularReciprocal(long a, long mod)
  5. modulo(final long x, final long y)