Java Reference
In-Depth Information
4.2.2. Integer Operations
The Java programming language provides a number of operators that act on integral values:
• The comparison operators, which result in a value of type
boolean
:
• The numerical operators, which result in a value of type
int
or
long
:
any specified numeric type
and an integral operand, will convert the integral operand to a
String
representing
its value in decimal form, and then produce a newly created
String
that is the con-
catenation of the two strings
Other useful constructors, methods, and constants are predefined in the classes
Byte
,
Short
,
Integer
,
Long
, and
Character
.
If an integer operator other than a shift operator has at least one operand of type
long
, then
the operation is carried out using 64-bit precision, and the result of the numerical operator
Otherwise, the operation is carried out using 32-bit precision, and the result of the numer-
ical operator is of type
int
. If either operand is not an
int
, it is first widened to type
int
by
numeric promotion.