Is there a better(Faster) way to split a binary string into an Array?
My code That loops and substring
every 8 characters in one element.
binary = my binary string(Huge) : "1010101011111000001111100001110110101010101"
int index = 0;
while (index < binary.length()) {
int num = binaryToInteger(binary.substring(index, Math.min(index + 8,binary.length())));
l.add( num);
temp = temp+ String.valueOf(num);
index += 8;
}
What I am trying to do is to split my binary string into pieces of 8 characters 10101010
and then get the int value of the 8 characters and will store that in arraylist
witch in this case was l
My code is working but is very time consuming.. Is there a faster way of getting this done?