[android-developers] Re: Why does Long.decode fail?

2011-08-10 Thread RichardC
I think it treats the hex value as positive as it can be preceeded by a minus sign. From the docs: The string may be an optional minus sign - followed by a hexadecimal (0x... or #...), octal (0...), or decimal (...) representation of a long. I agree it is unclear. On Aug 10, 8:29 pm, RLScott

Re: [android-developers] Re: Why does Long.decode fail?

2011-08-10 Thread Nick Risaro
On Wed, Aug 10, 2011 at 4:48 PM, RichardC richard.crit...@googlemail.comwrote: The string may be an optional minus sign - followed by a hexadecimal (0x... or #...), octal (0...), or decimal (...) representation of a long. I agree it is unclear. It's not unclear at all This sequence of

Re: [android-developers] Re: Why does Long.decode fail?

2011-08-10 Thread Kostya Vasilyev
In Java, integer types are signed. 10.08.2011 23:48, RichardC пишет: I think it treats the hex value as positive as it can be preceeded by a minus sign. From the docs: The string may be an optional minus sign - followed by a hexadecimal (0x... or #...), octal (0...), or decimal (...)

[android-developers] Re: Why does Long.decode fail?

2011-08-10 Thread hoyski
The problem is that 0x9774d56d682e549c is a positive value that's too large to fit in a 64 bit long. If the intent is that the high bit of the first digit indicates sign, then you'll need to mask off the high bit and add a leading minus sign when the high bit is on. E.g.

[android-developers] Re: Why does Long.decode fail?

2011-08-10 Thread RLScott
On Aug 10, 2:50 pm, Nick Risaro nris...@gmail.com wrote: It's not unclear at all This sequence of characters *must represent a positive value* or a NumberFormatExceptionhttp://download.oracle.com/javase/6/docs/api/java/lang/NumberFormatEx...will be thrown The docs for the Long class say

[android-developers] Re: Why does Long.decode fail?

2011-08-10 Thread RLScott
Well, it is no longer an issue. I decided to work with the byte array (String.getBytes(UTF-8)) instead. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe