Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert byte array to an integer/long/double

Status
Not open for further replies.

TheObserver

Programmer
Mar 26, 2002
91
US
I have a byte array I'm reading in from a file. I need to be able to take n bytes from that array and convert them into an integer/long/double, such that the resultant value is equal to the four bytes.

For example, if I have these values in my byte array:
10100111
00001010
11100110
10001010

I would like to read them like this:
10100111000010101110011010001010

And produce the value:
2802509450

Thanks for your time.
 
You should post in the general Java forum. This one uses to be just for J2EE questions.

If you post the way you're reading the file, it'd be useful too.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top