The code in bold is not making sense to me...the string array holds 8 different elements containing 4 characters each. Ex. string[0] = "0010"
string[1] = "0100"
When if(string[0] == "0010")...gets executed...the line below....s.append(2);.....is not executed...it is skipped...any ideas?
char[] divide = binaryNumber.toCharArray(); char[] copy = new char[32]; String[] string = new String[8]; int v; for(int j = 0; j < 32; ++j) copy[j] = '0'; for(int c = 0; c < divide.length; ++c) copy[c] = divide[c]; StringBuffer a = new StringBuffer(); StringBuffer b = new StringBuffer(); StringBuffer c = new StringBuffer(); StringBuffer d = new StringBuffer(); StringBuffer e = new StringBuffer(); StringBuffer f = new StringBuffer(); StringBuffer g = new StringBuffer(); StringBuffer h = new StringBuffer(); for(int i = 0; i < 4; ++i) a.append(copy[i]); string[0] = a.toString(); for(int j = 4; j < 8; ++j) b.append(copy[j]); string[1] = b.toString(); for(int k = 8; k < 12; ++k) c.append(copy[k]); string[2] = c.toString(); for(int l = 12; l < 16; ++l) d.append(copy[l]); string[3] = d.toString(); for(int m = 16; m < 20; ++m) e.append(copy[m]); string[4] = e.toString(); for(int n = 20; n < 24; ++n) f.append(copy[n]); string[5] = f.toString(); for(int o = 24; o < 28; ++o) g.append(copy[o]); string[6] = g.toString(); for(int p = 28; p < 32; ++p) h.append(copy[p]); string[7] = h.toString(); StringBuffer s = new StringBuffer(); [B]for(int y = 0; y < 8; ++y){ if(string[y]=="0000") ; if(string[y]=="0001") s.append(1); if(string[y]=="0010") s.append(2); if(string[y]=="0011") s.append(3); if(string[y]=="0100") s.append(4); if(string[y]=="0101") s.append(5); if(string[y]=="0110") s.append(6); if(string[y]=="0111") s.append(7); if(string[y]=="1000") s.append(8); if(string[y]=="1001") s.append(9); if(string[y]=="1010") s.append('A'); if(string[y]=="1011") s.append('B'); if(string[y]=="1100") s.append('C'); if(string[y]=="1101") s.append('D'); if(string[y]=="1110") s.append('E'); if(string[y]=="1111") s.append('F');[/B] }