Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
There is no such function in java and if you try to read first into byte array and then try to interpret as int like following code long lntohl = 0; lntohl = byteA[0] << 24; if you do this and any of the above byte has value 0XF*, then it is going to crap out. use this code if you want four byte into byte array as well as in long first mark position of buffer at 0 byte, then read four byte into array. after this call fun reser to set buffer pointer at 0 byte and use following code to get long value. long lValue = reply.read() << 24; lValue += reply.read() << 16; lValue += reply.read() << 8; lValue += reply.read() ; This will give you exact answer. But I do not like Java, because it is UGLY programming language, you can not do whatever you want unlike C++.
Sugnesh Patel Replies: |
Sponsored Links
|