Author Topic: [JAVA, W3XP, W3GS] Host Counter Decoding  (Read 15906 times)

0 Members and 1 Guest are viewing this topic.

Offline Camel

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
    • BNU Bot
Re: [JAVA, W3XP, W3GS] Host Counter Decoding
« Reply #15 on: December 09, 2009, 12:59:23 am »
(byte)Integer.parseInt should be in every way equivalent to Byte.parseByte...
No; parseByte() will throw an NFE if the number is too big, but the cast will simply truncate the high 24 bits. This is probably where the problem lies, since he said parseByte() doesn't work, when that's clearly what he should be using.

<Camel> i said what what
<Blaze> in the butt
<Camel> you want to do it in my butt?
<Blaze> in my butt
<Camel> let's do it in the butt
<Blaze> Okay!

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: [JAVA, W3XP, W3GS] Host Counter Decoding
« Reply #16 on: December 09, 2009, 01:22:12 am »
(byte)Integer.parseInt should be in every way equivalent to Byte.parseByte...
No; parseByte() will throw an NFE if the number is too big, but the cast will simply truncate the high 24 bits. This is probably where the problem lies, since he said parseByte() doesn't work, when that's clearly what he should be using.

I guess I knew that, but I didn't think it was relevant.  Of course, by "in every way", I meant for there to be an implied "in this context...".

Offline Lance

  • Full Member
  • ***
  • Posts: 129
    • View Profile
Re: [JAVA, W3XP, W3GS] Host Counter Decoding
« Reply #17 on: December 17, 2009, 08:30:00 pm »
(byte)Integer.parseInt should be in every way equivalent to Byte.parseByte...
No; parseByte() will throw an NFE if the number is too big, but the cast will simply truncate the high 24 bits. This is probably where the problem lies, since he said parseByte() doesn't work, when that's clearly what he should be using.

I guess I knew that, but I didn't think it was relevant.  Of course, by "in every way", I meant for there to be an implied "in this context...".
I went with the method you posted and everything has been good so far :)
Quote from: Joe
[23:55:31] [william@enterprise ~/Documents/Programming/javaop2]$ svn commit -m 'Tried to fix StayConnected. Again.'
Committed revision 63.
StayConnected strikes back!