This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
When we declare and store a character in java, it is represented in the memory as binary, is it possible to access and change the bits from the memory directly. To get more idea about the same which topic should I read.
Java Mobile and regular Java are identical in this regard, so you could have asked the question in the Java (Beginner) forum and gotten the same reply, but here it is:
Java uses Unicode as its internal character representation. To store in any other form (such as ASCII or EBCDIC), you'd have to store the data in a byte object and not a character/string object.
Java allows upcasting characters to integers. Once you have the value as an integer, you can do all the usual integer and bit operations on that integer. To return the data to character form, you have to downcast it again.
final int HEX10 = (int) 'A'; int hex12 = ( ((int) 'C') - HEX10 ) + 10;
An IDE is no substitute for an Intelligent Developer.
Joined: Dec 27, 2008
Java uses 16 bits for each character. Low-order 8 bits stands for the ascii value. Is it possible to store some extra bits in the high-order 8 bits ?