I have the following piece of code that i want to convert what i read in from the text file into a binary representation so i can use it to do encryption.
It currently looks like this:
The test file is am using is already in binary. 00001111
The problem I'm having is a number exception error I can read the file in ok to a string - but when i try to convert the string to an integer with base 2 i get the format error.
My eventual aim is to convert text from a file into binary -> pass that into an encryption algorithm and encrypt. i can do the conversion from text to binary no probs - i just cant get past this number exception error.
This is the output from java. (btw it compiles fine)
C:\sdes>java SdesStart e 0000011111 testfile.txt going to encrypt 100
Exception in thread "main" java.lang.NumberFormatException: For input string: "1 00 " at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at SdesStart.readFile(SdesStart.java:119) at SdesStart.main(SdesStart.java:43)