Casting ((char) a) where a is any number between int range

I know that ASCII codes are between 0-127 in decimal and 0000 0000 to 0111 1111 in binary, and values ​​between 128-255 are extended ASCII.

I also know that int takes 9 digits (which I was mistaken, the range of int is between (-2,147,483,648 to 2,147,483,647)), so if we produce each number between (0-Max int Range) to a char , there will be many characters; eg:

(char)999,999,999 gives 짿, which is a Korean character (I don’t know what that means, Google Translate cannot find any meaning!).

The same thing happens with values ​​between min int range to 0.

It does not make sense that these characters were entered one after another.

I don’t understand - how could they designate these large numbers as their own character?

+4
source share
1 answer

I don’t understand how they assign these large numbers their own character?

Assignments are performed by the Unicode consortium. See http://unicode.org for more details.

In your particular case, however, you are doing something completely meaningless. You have an integer 999999999, which in hexadecimal is 0x3B9AC9FF. Then you drop it to char, which drops the top four bytes and gives you 0xC9FF. If you look at Unicode.org: http://www.unicode.org/cgi-bin/Code2Chart.pl and find out that yes, this is a Korean character.

Unicode code points can actually be quite large; there are more than a million of them. But you cannot get to them just by throwing it. To move to Unicode codes outside the "normal" range using UTF-16 (as C # does), you need to use two characters. See http://en.wikipedia.org/wiki/UTF-16 , section on surrogate pairs.

To fix some other issues in your question:

I know that ACCII codes are between (0-127) in decimal and (0000 0000 to 0000 1111) in binary format.

This is ASCII , not ACCII , but 127 in binary format - 01111111, not 00001111

We also know that int takes 9 digits, so if we produce each number between

The int range is more than that.

don't know what that means, even google translate can't find any meaning

Korean is not like Chinese, where each glyph represents a word. These are letters. They have no meaning unless they accidentally form a word. You will have about as many lucky random English letters and attempts to find their meaning; maybe sometimes you choose CAT at random, but most of the time you choose XRO or some thing that is not a word.

Read this if you want to understand how the Korean alphabet works: http://en.wikipedia.org/wiki/Hangul

+20
source

All Articles