Results 1 to 5 of 5
Thread: what this snippet will do?
- 11-04-2012, 03:10 PM #1
Member
- Join Date
- Nov 2012
- Posts
- 3
- Rep Power
- 0
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
- 11-04-2012, 08:17 PM #2
Member
- Join Date
- Sep 2012
- Posts
- 34
- Rep Power
- 0
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. :)
- 11-04-2012, 08:47 PM #3
Member
- Join Date
- Nov 2012
- Posts
- 3
- Rep Power
- 0
Re: what this snippet will do?
unfortunnaly i dont have java enviroment right now
-
Re: what this snippet will do?
- 11-04-2012, 09:07 PM #5
Member
- Join Date
- Nov 2012
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Example Count From Array Snippet
By Vinx in forum Reviews / AdvertisingReplies: 1Last Post: 05-18-2012, 05:22 AM -
Code snippet pls?
By Srinivas0615 in forum New To JavaReplies: 1Last Post: 07-29-2011, 10:32 PM -
what are the problems of the snippet
By QkrspCmptPop in forum Threads and SynchronizationReplies: 1Last Post: 01-26-2010, 01:21 AM -
J2ME MIDlet snippet
By Java Tip in forum Java TipReplies: 0Last Post: 11-21-2007, 11:41 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks