Hi,
If you have written the integer in Java ( using DataOutputStream), Unix or
any other Big endian system
Do something like
InputStream in;
int i = (((( in.read() << 8) | in.read())) << 16) | (( in.read() << 8) |
in.read());
If you have written the int on a windows or any other small endian system
(Java is big-endian on all platforms) use something like
InputStream in;
int i = (in.read() | (in.read() << 8)) | ((in.read() | (in.read() << 8)) <<
16);
Hope it helps.
Rajesh
----- Original Message -----
From: Vassiliadis Michalis <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 18, 1999 12:56 AM
Subject: Byte conversion
> Hi!
> I am trying to read a compessed file (zip format) where there are data
> values. Using the method int read(byte[] b, int off, int len) of the
> ZipInputStream class, I get the data in byte format. How can I convert
them
> to another format (i.e. Integer)?
> Thanks in advance.
>
> -
> Michalis Vassiliadis
> Systems Engineer
> ---------------------
> BULL S.A.
> 67B, Sofouli, 551 31,
> Thessaloniki, Greece.
> Tel & Fax: 0030-31-423866
> http://www.bull.gr
> http://www.bull.com
>
>