Package host.fai.lib.faiNumber
Class OctalUtil
- java.lang.Object
-
- host.fai.lib.faiNumber.OctalUtil
-
public final class OctalUtil extends Object
The
OctalUtil
class is a final class that provides static methods for converting octal values in string representation as bits to a Java's Primitive Data Type.Currently this class supports converting octal values in string representation to integer int values and integer long values.
This class treats octal strings as bit values represented by octal digits and not real numbers. Thus, octal strings parse by this class will be converted to the suppored data types as if they were real bit values represented by octal digits.
To treats octal values as signed or unsigned real base 8 numbers use
Base8Util
.- Since:
- 1.0.0.f
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
toInt(String input)
Parse theinput
string as bits represented by octal digits to an integer int value.static long
toLong(String input)
Parse theinput
string as bits represented by octal digits to an integer long value.
-
-
-
Method Detail
-
toInt
public static int toInt(String input)
Parse theinput
string as bits represented by octal digits to an integer int value.- Parameters:
input
- A string to be parsed as octal digits to an interger int value.- Returns:
- An integer int value of the octal
input
string. - Throws:
NumberFormatException
- If theinput
string contains invalid octal digits, or if theinput
string contains a value that is beyond 32 bits. Leading zeroes do not count.EmptyStringException
- If theinput
string is empty.- Since:
- 1.0.0.f
-
toLong
public static long toLong(String input)
Parse theinput
string as bits represented by octal digits to an integer long value.- Parameters:
input
- A string to be parsed as octal digits to an interger long value.- Returns:
- An integer long value of the octal
input
string. - Throws:
NumberFormatException
- If theinput
string contains invalid octal digits, or if theinput
string contains a value that is beyond 64 bits. Leading zeroes do not count.EmptyStringException
- If theinput
string is empty.- Since:
- 1.0.0.f
-
-