Array problem.
Ok I have a problem, I'm making an ip calculator that calculates the subnet address and the NetID.
I've created 2 arrays which contain the binary code of the octet handleling the Mask and the IP field, this is working fine, so you get a bunch of 0 and 1's
To find out what the NetID is you AND the to arrays thats what my code below is supposed to do.
But its of cource not, it says 1 * 0 = 2342 which is weird, because when I System.out.println (supipa.charAt(0) i get either 0 or 1, same for maska.charAt(0).
My question is way does it do this, can't an array multiply or something.
int[] subnetidarray =newint [AANTAL_BIT];
for (int b =0; b<subnetidarray.length; b++){
subnetidarray[b] = subipa.charAt(b) * maska.charAt(b);
}
for (int n = 0; n><subnetidarray.length; n++){
buffer.append (subnetidarray[n]);
}
netid.setText(buffer.toString());
>

