0

Hey Guys,
I want to convert a character to it's bit representation.
For eg:
If i have the char 'J' then it's bit representation is '01001010'.
Pleae tell how??

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by masijade
0
Integer.toBinaryString((int) 'J')

See the API docs.

And don't forget to left pad it with zeroes, as it will only produce a String as long as it needs to be, rather than the full 8 bits. I.E. if the "full" bit string should be "0000101" this will only produce "101". Or, if the bit string should be "00110010" it will produce "110010".

Edited by masijade: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.