LEXICAL STRUCTURE
Integer Literals
3.10.1
Note that octal numerals are always consist of two or more digits;
0
 is always
considered to be a decimal numeral not that it matters much in practice, for the
numerals
0
,
00
, and
0x0
 all represent exactly the same integer value.
The largest decimal literal of type
int
 is
2147483648
 (2
31
). All decimal liter 
als from
0
 to
2147483647
 may appear anywhere an
int
 literal may appear, but
the literal
2147483648
 may appear only as the operand of the unary negation
operator
.
The largest positive hexadecimal and octal literals of type
int
 are
0x7fffffff
 and
017777777777
, respectively, which equal
2147483647
(2
31
  1 ). The most negative hexadecimal and octal literals of type
int
 are
0x80000000
 and
020000000000
, respectively, each of which represents the deci 
mal value
 2147483648
 ( 2
31
). The hexadecimal and octal literals
0xffffffff
and
037777777777
, respectively, represent the decimal value
 1
.
See also
Integer.MIN_VALUE
 ( 20.7.1) and
Integer.MAX_VALUE
 ( 20.7.2).
A compile time error occurs if a decimal literal of type
int
 is larger than
2147483648
 (2
31
), or if the literal
2147483648
 appears anywhere other than as
the operand of the unary
 operator, or if a hexadecimal or octal
int
 literal does
not fit in 32 bits.
Examples of
int
 literals:
0
2
0372
0xDadaCafe
1996
0x00FF00FF
The largest decimal literal of type
long
 is
9223372036854775808L
(2
63
).
All decimal literals from
0L
 to
9223372036854775807L
 may appear anywhere a
long
 literal may appear, but the literal
9223372036854775808L
 may appear only
as the operand of the unary negation operator
.
The largest positive hexadecimal and octal literals of type
long
 are
0x7fffffffffffffffL
 and
0777777777777777777777L
, respectively, which
equal
9223372036854775807L
 ( 2
63
  1 ). The literals
0x8000000000000000L
and
01000000000000000000000L
 are the most negative
long
 hexadecimal and
octal literals, respectively. Each has the decimal value
  9223372036854775808L
( 2
63
). The hexadecimal and octal literals
0xffffffffffffffffL
 and
01777777777777777777777L
, respectively, represent the decimal value
 1L
.
See also
Long.MIN_VALUE
 ( 20.8.1) and
Long.MAX_VALUE
 ( 20.8.2).
A compile time error occurs if a decimal literal of type
long
 is larger than
9223372036854775808L
 (2
63
), or if the literal
9223372036854775808L
 appears
anywhere other than as the operand of the unary
 operator, or if a hexadecimal or
octal
long
 literal does not fit in 64 bits.
Examples of
long
 literals:
0l
0777L
0x100000000L
2147483648L
0xC0B0L
21






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved