Apologies for the possibly poorly written question and lack of knowledge.
Im trying to store the actual character "0" in an array but it keeps defaulting to null. Is there anyway to avoid this? Below is a modified version of my code. I am trying to compare two binary numbers and then when the numbers dont match, the following numbers become all zeroes. Any help would be greatly appreciated
String fullBinOne = "1010101010100101"
String fullBinTwo = "1010101010101010"
char[] charBinOne = fullBinOne.toCharArray();
char[] charBinTwo = fullBinTwo.toCharArray();
char[] routeSummaryArray = fullBinOne.toCharArray();
int subnetCIDR = 0;
for (int i = 0; i < charBinOne.length; i++){
if (charBinOne[i] != charBinTwo[i]) {
subnetCIDR = i;
break;
}
}
for (int i = subnetCIDR; i < charBinOne.length; i++){
routeSummaryArray[i] = (char)0;
}
The output of routeSummaryArray is "101010101010 " instead of being 1010101010100000
0is indicated by'0', not by(char) 0.routeSummaryArray?