Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
java byte question
Name: tl1_mossman2 Date: April 25, 2004 at 23:07:50 Pacific OS: windex CPU/Ram: 3hz/1b
Comment:
I've a question... im begining to get into networking...
setting up an InetAddress, there's a constructor that takes a byte array...
i'd like to use bytes for construction, however, they seem to only take values to 127 (eighth byte indicating negative or not)... my question, anyway to construct a byte array containing more then 127 as a possible value per byte?
-just curious... seems kind of useless to put a byte array constructor into InetAddress if there's no way to get a value higher then 127...
Name: wharfie Date: April 26, 2004 at 17:59:18 Pacific
Reply:
The maximum value of 7 bits is 127. As you already know the 8th bit is used to determine sign.
Binary 1111111 = 127
If you need to use values larger than 127 then use another data type, eg short, int, long.
0
Response Number 2
Name: gpp Date: April 27, 2004 at 05:40:58 Pacific
Reply:
Just curious as to why you need a byte to hold more than that. A byte array should cover any address you can think of.
0
Response Number 3
Name: tl1_mossman2 Date: May 5, 2004 at 14:05:14 Pacific
Reply:
InetAddress "constructor" (can) use a byte array... but InetAddress's are from 0 to 255... so... bit unusual having a byte "constructor" that can only access addresses with bytes under 128...
Summary: Hello, I have just started taking Java (programming III/IV) at my high school, and was wondering if any of you can give me a better explanation of the following question, than what my teacher had told...
Summary: I am new to Java and programming in general, just starting to take a class in the fall. I have two questions. Is there a way to print out a message and make a program stop, like in an if/else statemen...
Summary: In Java, when I read a line by executing .readLine(), the pointer gets to point the begining of the next line in a stream. My question is if there is any way to go back to the begining of the previou...