In this section, we will learn how to convert Text to Binary. The following program provides you the functionality to convert Text to Binary.
In the program code below, to take the input from the keyboard we have used BufferReader() method in which we have passed an object of it which is InputStreamReader() as must be knowing. Then we have defined a variable of type int which will convert the input to integer line by line. Now we have used a loop here to check the number we well input. It will take maximum of 24 bytes as we have declared maxBytes=3. Hence it will convert the number into bytes one by one.
Here is the code of the program:
Output of the program:
Type the number to parse: 417893
Type the number to parse: 3289
Type the number to parse:
Posted on: August 6, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles