Over a million developers have joined DZone.

Java’s missing unsigned integer types

DZone's Guide to

Java’s missing unsigned integer types

· Java Zone
Free Resource

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

This is a topic that has been discussed many times before. Java’s lack of unsigned byte/short/int/long types. The main reasons why the JLS designers omitted those types were:

  1. They’re hardly really useful
  2. They’re a bit more difficult to implement
  3. They’re a bit more difficult to understand
  4. They would lead to more primitive types that have to be treated separately from the existing ones
  5. … and probably, there are more reasons

Nevertheless, these types are sometimes useful for cryptography, image processing, binary protocols, everything related to binary data (why is byte unsigned after all??), and the list of rants in the following ticket at Sun/Oracle is long:


For jOOQ, unsigned number types would be useful, as some databases support them (e.g. MySQL, Postgres). And they’re not necessarily trivial to map to Java. So I was looking for a good solution. The best one being to use wrapper classes extending java.lang.Number. So, I have raised the question on Stack Overflow to find such a library:


Incredibly, no one seems to have done this – except for some partial implementations in some large libraries. So I’m launching a new OSS project called jOOU – U is for Unsigned. Check out a small library for Java Unsigned Number wrappers:



From http://lukaseder.wordpress.com/2011/11/20/javas-missing-unsigned-integer-types/

Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}