Here you can find the source of mod(long pNum, long pDivisor)
public static long mod(long pNum, long pDivisor)
//package com.java2s; public class Main { public static long mod(long pNum, long pDivisor) { long divisor = Math.abs(pDivisor); return (pNum % divisor + divisor) % divisor; }//from ww w. j av a2 s. c om public static int mod(int pNum, int pDivisor) { int divisor = Math.abs(pDivisor); return (pNum % divisor + divisor) % divisor; } public static float mod(float pNum, float pDivisor) { return ((pNum % pDivisor) + pDivisor) % pDivisor; } }