Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.logging.log4j.core.util
Class Integers

    java.lang.Object
      org.apache.logging.log4j.core.util.Integers

    public final class Integers

extends Object

Helps deal with integers.

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### parseInt

    public static int parseInt(String s,
                               int defaultValue)

  Parses the string argument as a signed decimal integer.

  Parameters:
    `s` - a `String` containing the `int` representation to parse, may be `null` or `""`
    `defaultValue` - the return value, use `defaultValue` if `s` is `null` or `""`
  Returns:
    the integer value represented by the argument in decimal.
  Throws:
    `NumberFormatException` - if the string does not contain a parsable integer.

### parseInt

    public static int parseInt(String s)

  Parses the string argument as a signed decimal integer.

  Parameters:
    `s` - a `String` containing the `int` representation to parse, may be `null` or `""`
  Returns:
    the integer value represented by the argument in decimal.
  Throws:
    `NumberFormatException` - if the string does not contain a parsable integer.

### ceilingNextPowerOfTwo

    public static int ceilingNextPowerOfTwo(int x)

  Calculate the next power of 2, greater than or equal to x.

  From Hacker's Delight, Chapter 3, Harry S. Warren Jr.

  Parameters:
    `x` - Value to round up
  Returns:
    The next power of 2 from x inclusive

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2015 Apache Software Foundation. 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.