Here you can find the source of modulo(long a, long n)
Parameter | Description |
---|---|
a | Input operand. |
n | Modulus. |
public static long modulo(long a, long n)
//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; } }