public final class Integers extends Object
Modifier and Type | Method | Description |
---|---|---|
static int |
ceilingNextPowerOfTwo(int x) |
Calculate the next power of 2, greater than or equal to x.
|
static int |
parseInt(String s) |
Parses the string argument as a signed decimal integer.
|
static int |
parseInt(String s,
int defaultValue) |
Parses the string argument as a signed decimal integer.
|
public static int parseInt(String s, int defaultValue)
s
- a String
containing the int
representation to parse, may be null
or ""
defaultValue
- the return value, use defaultValue
if s
is null
or ""
NumberFormatException
- if the string does not contain a parsable integer.public static int parseInt(String s)
s
- a String
containing the int
representation to parse, may be null
or ""
NumberFormatException
- if the string does not contain a parsable integer.public static int ceilingNextPowerOfTwo(int x)
From Hacker's Delight, Chapter 3, Harry S. Warren Jr.
x
- Value to round upCopyright © 1999-2018. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.