There are many cases where unsigned integer arithmetic is preferable and more convenient to work with than the signed integer arithmetic provided by Java. Unsigned arithmetic on 32 bit and 64 integers could be provided by adding static methods to Integer and Long, e.g. Integer.addUnsigned, Integer.divideUnsigned, etc.
Name: jd38982 Date: 02/04/2002
Customer Problem Description:
jdk doesn't support unsigned long value. The "long" data type is a
signed long data type in jdk1.3 or jdk1.4. That means for positive number, it only support up to 63 bits. If a positive number that is bigger than 63
bits, it becomes a negative number. We need jdk to support an unsigned
Name: rmT116609 Date: 08/14/2003
A DESCRIPTION OF THE REQUEST :
Java primitive number are byte (8 bits signed), short (16 bits signed), int (32 bits signed) and long (64 bits signed). It may be the time for java to add capability to optimal arithmetic with 128 bits signed integers because 64 bits processors will make 128 bits operation as fast as actual 64 bits. We propose the keyword 'huge' and also the associated class Huge. Moreover algorithm like digest (SHA, MD5) and cryptography need to make operation on block of 128 bits size !
It will help making computation on CRC, Error Correcting Code, Digest (MD5) impressively faster than with BigInteger class.
It is a natural evolution like for type long in a 32 bits environnement.
EXPECTED VERSUS ACTUAL BEHAVIOR :
To have more choice for choosing type of integers to make arithmetic with java.
To have a powerful type to make 128 bits computation which will be JVM optimized.
To make arithmetic with more than 63 bits unsigned and 64 bits signed you have to use the class BigInteger which is far more slower than using primitive type.
Instead you have to code your own 128 bits computation instrument which cannot be as optimized as a native primitive java type !
CUSTOMER SUBMITTED WORKAROUND :
(Review ID: 199026)
Discussion of API for this RFE: