I have a text file that contains "binary", which is simply just a long string of binary numbers that will represent assembly instructions further down the road. At the moment what I want to do is take this long string of binary numbers and load it into a String[]
8 characters at a time.
So for example:
0000000100000002000000030000000400000005000000060000000700000008
Would be read in as:
[0] 000000001
[1] 000000002
[2] 000000003
[3] 000000004
[4] 000000005
[5] 000000006
[6] 000000007
[7] 000000008
The only way I can think about doing this right now is by reading in the entire string and storing it in a String
variable, then iterating through the variable 8 chars at a time and using substring()
to slice the big string into smaller 8 char strings.
Surely there must be a more efficient way of doing this?