com.kuka.common
Class IntegerUtil

java.lang.Object
  extended by com.kuka.common.IntegerUtil

public final class IntegerUtil
extends Object

Utility class with some integer related helper methods.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

Field Summary
static String EMPTY
          Empty String.
static String PREFIX_BINARY
          The prefix to identify binary values.
static String PREFIX_HEXADECIMAL
          The prefix to identify hexadecimal values.
 
Method Summary
static Integer parseIntFromBinOrHex(String value)
          Tries to parse an Integer value out of the given string.
static String toBinaryString(Integer value)
          Converts a given integer value to binary and adds the binary prefix in front of it.
static String toHexadecimalString(Integer value)
          Converts a given integer value to hexadecimal and adds the binary prefix in front of it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX_BINARY

public static final String PREFIX_BINARY
The prefix to identify binary values.

See Also:
Constant Field Values

PREFIX_HEXADECIMAL

public static final String PREFIX_HEXADECIMAL
The prefix to identify hexadecimal values.

See Also:
Constant Field Values

EMPTY

public static final String EMPTY
Empty String.

See Also:
Constant Field Values
Method Detail

parseIntFromBinOrHex

public static Integer parseIntFromBinOrHex(String value)
Tries to parse an Integer value out of the given string.

If string starts with 'b' it is parsed as binary.

If string starts with '0x' it is parsed as hexadecimal.

If string starts with number directly, it is parsed as decimal.

Parameters:
value - String value with or without leading format information
Returns:
parsed integer value

toBinaryString

public static String toBinaryString(Integer value)
Converts a given integer value to binary and adds the binary prefix in front of it. (e.g. 5 => b101)

Parameters:
value - integer value
Returns:
string that contains a leading binary prefix and the given value converted to binary

toHexadecimalString

public static String toHexadecimalString(Integer value)
Converts a given integer value to hexadecimal and adds the binary prefix in front of it. (e.g. 255 => 0xFF)

Parameters:
value - integer value
Returns:
string that contains a leading binary prefix and the given value converted to hexadecimal


Copyright © 2019. All rights reserved.