Java Reference
In-Depth Information
B.3.3. Using parallelPrefix
The parallelPrefix method cumulates, in parallel, each element of the given array, using the
supplied binary operator. In the next listing you produce the values 1, 2, 3, 4, 5, 6, 7, ....
Listing B.3. parallelPrefix cumulates in parallel elements of an array
B.4. Number and Math
The Java 8 API enhances the Number and Math classes with new methods.
B.4.1. Number
The new methods of the Number class are as follows:
The Short , Integer , Long , Float , and Double classes include the sum , min , and max static
methods. You saw these methods in conjunction with the reduce operation in chapter 5 .
The Integer and Long classes include the methods compareUnsigned , divideUnsigned ,
remainderUnsigned , and toUnsignedString to work with unsigned values.
The Integer and Long classes also respectively include the static methods parse-UnsignedInt and
parseUnsignedLong , to parse strings as an unsigned int or long .
The Byte and Short classes include the methods toUnsignedInt and toUnsigned-Long , to convert
the argument to an int or long by an unsigned conversion. Similarly, the Integer class now includes
the static method toUnsignedLong .
The Double and Float classes include the static method isFinite , to check whether the argument is a
finite floating-point value.
The Boolean class now includes the static methods logicalAnd , logicalOr , and logicalXor , to apply
the and , or , and xor operations between two boolean s.
The BigInteger class includes the methods byteValueExact , shortValueExact , intValueExact ,
and longValueExact , to convert this BigInteger to the respective primitive type. But it throws an
arithmetic exception if there's a loss of information during the conversion.
 
Search WWH ::




Custom Search