fork(1) download
  1. class Ideone
  2. {
  3. public static void main (String[] args) throws java.lang.Exception
  4. {
  5. String s = "😂";
  6. int emoji = Character.codePointAt(s, 0);
  7. String unumber = "U+" + Integer.toHexString(emoji).toUpperCase();
  8. System.out.println(s + " is code point " + unumber);
  9. String s2 = new String(new int[] { emoji }, 0, 1);
  10. System.out.println("Code point " + unumber + " converted back to string: " + s2);
  11. System.out.println("Successful round-trip? " + s.equals(s2));
  12. }
  13. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
😂  is code point U+1F602
Code point U+1F602 converted back to string: 😂
Successful round-trip? true