Package com.tagtraum.core.util
Class NumberParser
- java.lang.Object
-
- com.tagtraum.core.util.NumberParser
-
public class NumberParser extends Object
Utility class for faster number parsing from "Performant Java programmieren", Hendrik Schreiber, Addison Wesley 2002.- Author:
- Hendrik Schreiber
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_NEGATIVE_INTEGER_CHARS
static int
MAX_NEGATIVE_LONG_CHARS
static int
MAX_POSITIVE_INTEGER_CHARS
static int
MAX_POSITIVE_LONG_CHARS
-
Constructor Summary
Constructors Constructor Description NumberParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
parseHex(char[] cb)
Parse 4 char hex string.static int
parseInt(char[] cb, int offset, int length)
static int
parseInt(String s)
static int
parseInt(String s, int offset, int length)
static long
parseLong(char[] cb, int offset, int length)
static long
parseLong(String s)
static long
parseLong(String s, int offset, int length)
-
-
-
Field Detail
-
MAX_NEGATIVE_INTEGER_CHARS
public static final int MAX_NEGATIVE_INTEGER_CHARS
-
MAX_POSITIVE_INTEGER_CHARS
public static final int MAX_POSITIVE_INTEGER_CHARS
-
MAX_NEGATIVE_LONG_CHARS
public static final int MAX_NEGATIVE_LONG_CHARS
-
MAX_POSITIVE_LONG_CHARS
public static final int MAX_POSITIVE_LONG_CHARS
-
-
Method Detail
-
parseInt
public static int parseInt(char[] cb, int offset, int length) throws NumberFormatException
- Throws:
NumberFormatException
-
parseInt
public static int parseInt(String s) throws NumberFormatException
- Throws:
NumberFormatException
-
parseInt
public static int parseInt(String s, int offset, int length) throws NumberFormatException
- Throws:
NumberFormatException
-
parseLong
public static long parseLong(String s) throws NumberFormatException
- Throws:
NumberFormatException
-
parseLong
public static long parseLong(String s, int offset, int length) throws NumberFormatException
- Throws:
NumberFormatException
-
parseLong
public static long parseLong(char[] cb, int offset, int length) throws NumberFormatException
- Throws:
NumberFormatException
-
parseHex
public static int parseHex(char[] cb)
Parse 4 char hex string.- Parameters:
cb
- char buffer, expected to 4 chars long- Returns:
- int
-
-