java - Conversion from char to byte -
how character converted byte in java? if write
char c=12; byte b=(byte)c; system.out.println(b);
then result 12,as expected but... if,i write
char c='\u0012'; byte b=(byte)c; system.out.println(b);
then result 18. how???
the \u0012
in hexadecimal format, value 18
. 12
, have use \u000c
.
example -
char c='\u000c'; byte b=(byte)c; system.out.println(b); >> 12
Comments
Post a Comment