Here you can find the source of mod(int a, int b)
Parameter | Description |
---|---|
a | The modee |
b | The value to mod by |
public static int mod(int a, int b)
//package com.java2s; public class Main { /**/*from w w w . j a v a 2s .c om*/ * Utility which does *proper* modding, where the result is guaranteed to be * positive. * * @param a The modee * @param b The value to mod by * @return The result */ public static int mod(int a, int b) { return ((a % b) + b) % b; } }