I have a char array that takes in a binary string of length n. It can only have 0s and 1s.
What I want to do is, I want to make a string array and store the first 2 values of the char array array jointly to the 1st index of this string array.
For example -
11011101
Is my char array. I want to convert it to an array that would be like -
newArray[0] = 11;
newArray[1] = 01;
newArray[2] = 11;
newArray[3] = 01;
So basically I just want to split every 2 integers and save them to the newArray in this manner.
My problem is
for (int j = 0; j < binaryString.length; j++) {
lookUp[j] = binaryString.toString().substring(j, j+1);
}
Which is just giving me the memory locations of the indexes.
Thanks in advance!