Java.lang Package Classes

Java Integer - divideUnsigned() Method



The java.lang.Integer.divideUnsigned() method returns the unsigned quotient of dividing the first argument by the second where each argument and the result is interpreted as an unsigned value.

Syntax

public static int divideUnsigned(int dividend,
                                 int divisor)

Parameters

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

Return Value

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

Exception

NA.

Example:

In the example below, the java.lang.Integer.divideUnsigned() method returns the unsigned quotient of dividing given arguments.

import java.lang.*;

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

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

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

The output of the above code will be:

quotient of x/y: 0
quotient of y/x: 2

❮ Java.lang - Integer

5