Facebook Page Twitter Page LinkedIn Page
× Java.lang Package Classes


The java.lang.Integer.remainderUnsigned() method is used to return the unsigned remainder from dividing the first argument by the second where each argument and the result is interpreted as an unsigned value.

Syntax

public static int remainderUnsigned(int dividend,
                                    int divisor)

Parameters

x Specify the value to be divided.
y Specify the value doing the dividing.

Return Value

Returns the unsigned remainder of the first argument divided by the second argument.

Exception

NA.

Example:

In the below example, the java.lang.Integer.remainderUnsigned() method is used to return the unsigned remainder of dividing given arguments.

import java.lang.*;

public class MyClass {
  public static void main(String[] args) {
    
    //creating int values
    int x = 5;
    int y = 18;

    //printing remainder of dividing x by y 
    System.out.println("remainder of x/y: " + Integer.remainderUnsigned(x,y));

    //printing remainder of dividing y by x 
    System.out.println("remainder of y/x: " + Integer.remainderUnsigned(y,x)); 
  }
}

The output of the above code will be:

remainder of x/y: 5
remainder of y/x: 3

❮ Java.lang - Integer