I'm working on a project that makes use of a lot of byte arrays, and
I'm having an issue with certain bytes overflowing to negative values.
I know they're being stored properly because I'm also generating hex
dumps from time to time which indicate the real value is there. Can
someone tell me how to go about making comparisons with the actual
values?

user=> (byte 254)
-2

(def my-byte (make-array (Byte/TYPE) 1))
(aset my-byte 0 (byte 254))
(println (format-hex-string (HexByte/byteArrayToHexString my-byte)))
... returns "0xFE" ...

user=> (= (byte 254) 0xFE)
false

Thanks,
Travis
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to