I want to visually inspect all the characters that Java thinks are in any given UnicodeBlock. The following method, as far as I can tell, does the task. But, it sure feels like awful design.
public static void displayUnicodeBlock(Character.UnicodeBlock block) {
int maxCharVal = (int) Math.pow(2, 16);
for(int cInt = 0; cInt <= maxCharVal; cInt++) {
char c = (char) cInt;
if(Character.UnicodeBlock.of(c) == block) {
System.out.println("_" + c + "_");
}
}
}
- Would reflection be the ideal solution?
- Can reflection actually show every character in a UnicodeBlock? How?
- My solution is stupid because it is inefficient?
- My solution is stupid because it is hardwired with 2^16?