import java.io.UnsupportedEncodingException;
class Test {
public static void main(String[] args) {
char c = '中';
System.out.printf("%04x%n", (int) c);
byte[] unicode = { (byte) ((c >> 8) & 0xff), (byte) (c & 0xff) };
System.out.printf("%2d, %02x%n", unicode[0], unicode[0]);
System.out.printf("%2d, %02x%n", unicode[1], unicode[1]);
try {
byte[] by = String.valueOf(c).getBytes("UnicodeBigUnmarked");
for(byte b: by) {
System.out.println(b);
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
?