Characters without BMP (basic multilingual planes) cannot be represented as Java char (or, therefore, a Character ), because char is only a 16-bit unsigned integer. Non-BMP characters are represented using surrogate pairs in Java.
You will need to use a string ... but even then I suspect that you will need to provide a surrogate character pair explicitly. C # has an escape sequence \U , which is equivalent to \U , but for 32-bit values, but Java has nothing like this :(
Here is an alternative approach that allows you to use the Unicode value directly in your code:
String x = new String(new int[] { 0x1f000 }, 0, 1);
It's ugly, but it works ...
source share