Legend goes that Gosling went around Sun offices and almost everyone failed to get unsigned versus signed math right, so they went with signed only types.
http://www.gotw.ca/publications/c_family_interview.htm
> Quiz any C developer about unsigned, and pretty soon you discover that almost no C developers actually understand what goes on with unsigned, what unsigned arithmetic is. Things like that made C complex. The language part of Java is, I think, pretty simple. The libraries you have to look up.
At least Java 8 introduced unsigned math helper methods.
Except chars
> At least Java 8 introduced unsigned math helper methods.
They still aren't enough IMO. They don't have way ways to take LE/BE bytes out of integers or vice versa (not worth creating ByteBuffer for). I always end up recreating these utilities in projects where it isn't worth depending on or shading an entire Guava, e.g. [0]
0 - https://github.com/cretz/javan-warty-pig/blob/master/fuzz/sr...
I have to ask, why would you be trying to, I presume, be directly manipulating bytes in Java?
Thanks for answering!
I’m sure you’re aware of all this and I don’t want to backseat drive/code. It’s just I was on a project once where microsecond latency mattered and it was written in Java, but with a custom String class and custom garbage collection (using a custom object pool instead of relying on JVM’s to avoid any GC halt, which would be intolerable). It was a really fun project tech wise, but at that point, C/C++ would have made wayyyyyy more sense and saved us a lot of headaches.
https://www.ptc.com/en/products/developer-tools/perc
https://www.aicas.com/cms/en/JamaicaVM
https://www-03.ibm.com/software/products/bg/real-time
Then there are the Java variants out of Mountain View, although Android's performance is not in the same league as those ones.
This are just the most well known ones, Java is not only the OpenJDK.
As for microsecond latency, I guess it matters a lot to the US military.
http://www.militaryaerospace.com/articles/2006/10/lockheed-m...
"PERC Ultra offered Lockheed Martin the responsiveness it needed to meet its most demanding timing requirements. In addition to real-time threading and deterministic garbage collection, PERC Ultra provided the instrumentation and VM management tools necessary to support the mission-critical real-time requirements of the Aegis Weapon System."
"The Lockheed Martin-developed Aegis Weapon System is the sea-based element of the U.S. Ballistic Missile Defense System. The Aegis Weapon System is a radar and missile system integrated with its own command and control system, capable of simultaneous operation defending against advanced air, surface, and subsurface threats."
Edited: but Yes, and they're not the only ones that did radar or embedded software with PERC. There was a time (5-10 years ago ?) it was all the rage...
Video / audio codecs.
Cryptographic algorithms. (encrypt / decrypt, hash functions)
Cryptographic random number generators.
Ordinary random number generators.
PKI (key generation, validation)
Packing / unpacking binary structures used in wire protocols or message formats. (Example: a certificate, public key, jpeg, protocol buffers)
Implementing things like Protocol Buffer. (Language neutral binary format)
Implementing BigInteger. JDBC drivers.
Java libraries that create, compile, decompile or otherwise manipulate Java Byte Code.
Java libraries that create or manipulate other types of binary executable code. (eg, an EXE file)
Implementing Class Loaders for java.
The reasons you might work with bytes in Java are as endless as why you would work with bytes in C or any other language.
Thank you for the reminder!