Here you can find the source of mod(final int n, final int N)
public static int mod(final int n, final int N)
//package com.java2s; // it under the terms of the GNU General Public License as published by public class Main { public static int mod(final int n, final int N) { final double co; co = (n - N * (n / N));/*from ww w .j a va2s . c o m*/ return ((int) co); } }