JDK-4210457 : Package literals? EG: Integer.NUMBEROFBITS
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.1.6,1.2.0
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1999-02-10
  • Updated: 2003-09-09
  • Resolved: 2003-09-09
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description

Name: dbT83986			Date: 02/10/99


If I do anything vaguely low-level with Java's
primitive types, I end up with some powers of
two in my code. Would it not be clearer (esp.
for novice programmers) to have constants such as
Integer.NUMBEROFBITS rather than having to bear
the actual numbers in mind?

And though I can do without the above, it'd be
nice to have bitmasks for IEEE floating-point,
such as constants called e.g. SIGN, MANTISSA and
EXPONENT in classes Float and Double (of type
int and long respectively, and so accessible via
floatToIntBits and doubleToLongBits). And having
a constants so I don't have to remember that 
e.g. doubles have 53 bits precision would be
nice too.

(I see that the Win32 JDK has a class
FloatDecimal with these constants already in:
could they be moved/copied to some public
classes?)
(Review ID: 35635)
======================================================================

Comments
EVALUATION Will consider these requests as part of the work for bug 4633024. ###@###.### 2002-03-21 Bug 4495754 provides such information for the integer types. ###@###.### 2003-07-29 Fix for 4900166 adds SIZE fields for floating-point values too. Closing as a dup. Other floating-point related constants would be included as part of 4826652. ###@###.### 2003-09-08
2003-09-08