what this snippet will do?
hello,
im new to this, please help on this example what will be the output?
byte[] arrayOfByte = { (byte) 0xe7, (byte) 0x0a, (byte) 0x3f, (byte) 0x16, (byte) 0xcc, (byte) 0x16, (byte) 0x0c, (byte) 0xaf, (byte) 0x3d, (byte) 0x00, (byte) 0xd3, (byte) 0x0b, (byte) 0x71, (byte) 0x93, (byte) 0xc8, (byte) 0xf7};
int j = 0;
String str = "";
while (true)
{
if (j >= arrayOfByte.length)
return str;
str = str + Integer.toString(256 + (0xFF & arrayOfByte[j]), 16).substring(1); -can somebody explain what math happens here?
j++;
}
what will be in the str in the end?
many thanks
Re: what this snippet will do?
my advice is to simply use System.out.println(str); and find out.
as for the math itself, i will leave it to someone who knows. :)
Re: what this snippet will do?
unfortunnaly i dont have java enviroment right now
Re: what this snippet will do?
Quote:
Originally Posted by
fredfunk
unfortunnaly i dont have java enviroment right now
Then you'll want to check this out when you are able to compile and run this yourself. This site is not supposed to be used as a substitute for your Java compiler and JVM.
Re: what this snippet will do?
the forum's purpose is solved, thank you so much