Here you can find the source of modulo(int dividend, int divisor)
Parameter | Description |
---|---|
dividend | the number that is being divided by. Appears on Left |
divisor | the number the dividend is being divided by. Appears on Right |
public static int modulo(int dividend, int divisor)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w .j a v a 2 s . c om * Modulo Fix for negative numbers * * @param dividend the number that is being divided by. Appears on Left * @param divisor the number the dividend is being divided by. Appears on * Right * @return */ public static int modulo(int dividend, int divisor) { return (dividend % divisor + divisor) % divisor; } }