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. String IMEI = "36529874";
  13. StringBuilder IMEI_convertido = new StringBuilder();
  14. IMEI_convertido.append(
  15. Integer.toHexString(Integer.parseInt(IMEI.substring(0, 2)))).
  16. append(".").append(
  17. Integer.toHexString(Integer.parseInt(IMEI.substring(2, 4)))).
  18. append(".").append(
  19. Integer.toHexString(Integer.parseInt(IMEI.substring(4, 6)))).
  20. append(".").append(
  21. Integer.toHexString(Integer.parseInt(IMEI.substring(6, 8))));
  22. System.out.println("IMEI: " + IMEI + "; IMEI_convertido: " + IMEI_convertido);
  23. }
  24. }
Success #stdin #stdout 0.1s 320256KB
stdin
Standard input is empty
stdout
IMEI: 36529874; IMEI_convertido: 24.34.62.4a