Article View: borland.public.jbuilder.java.language
Article #7987Byte Array Conversion to Integer
From: Tom Heagy
Date: Mon, 07 May 2001 18:28
Date: Mon, 07 May 2001 18:28
12 lines
1476 bytes
1476 bytes
Question: How do I convert a byte array to an int or Integer? Problem: I'm receiving a TCP InputStream from a C application. The stream consists of a byte array that was built by the C application. Part of the byte array contains a number (converted to it's 4 byte format). How do I take these 4 bytes and convert them into a number I can use in my Java application? The String class provides a conversion constructor method for use with byte arrays but I can't find anything similar for numbers. Any suggestions would be greatly appreciated. -Tom
Technical Details
Message-ID:
<3af6e910$1_2@dnews>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!logbridge.uoregon.edu!hammer.uoregon.edu!feed.textport.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,840940854720c53,start X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-05-07 11:38:02 PST Reply-To: "Tom Heagy" <tom.heagy@sciatl.com> From: "Tom Heagy" <tom.heagy@sciatl.com> Newsgroups: borland.public.jbuilder.java.language Subject: Byte Array Conversion to Integer Date: Mon, 7 May 2001 14:28:29 -0400 Lines: 14 Organization: Scientific Atlanta X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 192.133.191.70 Message-ID: <3af6e910$1_2@dnews> X-Trace: dnews 989260048 192.133.191.70 (7 May 2001 11:27:28 -0700) Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!logbridge.uoregon.edu!hammer.uoregon.edu!feed.textport.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews