fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int color = 1751661885;
  13. System.out.printf("Packed color (dec): %d%n", color);
  14. System.out.printf("Packed color (hex): %08X%n", color);
  15.  
  16. int alpha = (color >> 24) & 0xFF;
  17. int red = (color >> 16) & 0xFF;
  18. int green = (color >> 8) & 0xFF;
  19. int blue = (color >> 0) & 0xFF;
  20.  
  21. System.out.printf("Hex: a=%02X r=%02X g=%02X b=%02X%n", alpha, red, green, blue);
  22. System.out.printf("Dec: a=%d r=%d g=%d b=%d%n", alpha, red, green, blue);
  23. }
  24. }
Success #stdin #stdout 0.05s 711168KB
stdin
Standard input is empty
stdout
Packed color (dec): 1751661885
Packed color (hex): 68683D3D
Hex: a=68 r=68 g=3D b=3D
Dec: a=104 r=104 g=61 b=61