Queries and Questions

I want to translate a string into a bitstream and then manipulate indivisual bits of the bitstream. I am able to do the conversion from string to a binary string. But since the return type is string the 0s and 1s are not treated as bits. How do I extract each bit such that the compiler recognizes it as a bit and not a char or a string?

String a="testcode";char c[]=a.toCharArray();StringBuilder sb=newStringBuilder()for(char c : car){String cbs=Integer.toBinaryString((int)c);
sb.append(cbs);}System.out.println(sb.toString);

i now want the individual bits in the generated bit string so that i can perform various bitwise operations such as inversion etc. How do i extract the bits as bits and not chars?

Advertisements

Constructive and genuine appreciation and/or criticism most welcome

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s