Java Quiz

Quiz: What is this code doing?

int c = ...;
byte[] bytes = (new String(new char[] { (char) c })).getBytes();

Found in some project where for some reason a file upload didn’t quite come back as it should…


No more comments.
  1. lol, that’s apply a 0xFFFF mask to int c, poor high bytes, they’ve not done nothing wrong

  2. Wow, fantastic, Java art, first you ask to yourself “WTF?” but then you realize it beauty, so is there any museum to show this piece of mastership ? I want to learn more of this stuff !!!!