Online Java Compiler By
JavaTpoint.com
public class IntegerToUnsignedLongExample1 { public static void main(String[] args) { int x1 = -5; int x2 = 5; int y1 = -6; int y2 = 6; //Performs unsigned operation treating x and y holding unsigned values long ux1 = Integer.toUnsignedLong(x1); long ux2 = Integer.toUnsignedLong(x2); long uy1 = Integer.toUnsignedLong(y1); long uy2 = Integer.toUnsignedLong(y2); System.out.println("Unsigned x1 = " + ux1); System.out.println("Unsigned x2 = " + ux2); System.out.println("Unsigned y1 = " + uy1); System.out.println("Unsigned y2 = " + uy2); } }
Output