How do you fix this??
For the following line in my program JaCoCo shows: "1 of 2 branches missed"
if(ia.length() < i+1){
Also for the following line i get: "1 of 4 branches missed"
if(ia.length() <= i+1 && ib.length() <= i+1){
the whole code:
public static int convertBits(int a, int b) {
String ia = Integer.toBinaryString(a);
String ib = Integer.toBinaryString(b);
int s = 0;
for(int i = 0;;i++){
char a1 = '0';
char a2 = '0';
if(ia.length() < i+1){
a1 = '0';
}else{
a1 = ia.charAt(ia.length() - i - 1);
}
if(ib.length() < i+1){
a2 = '0';
}else{
a2 = ib.charAt(ib.length() - i - 1);
}
if(a1 != a2){
s++;
}
if(ia.length() <= i+1 && ib.length() <= i+1){
break;
}
}