Package ghidra.util

Class NumericUtilities


  • public final class NumericUtilities
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      ChangeModifier and Type Method Description
      static long bigIntegerToUnsignedLong​(java.math.BigInteger value)  
      static java.lang.String convertBytesToString​(byte[] bytes)
      Convert a byte array into a hexadecimal string.
      static java.lang.String convertBytesToString​(byte[] bytes, int start, int len, java.lang.String delimeter)
      Convert a byte array into a hexadecimal string.
      static java.lang.String convertBytesToString​(byte[] bytes, java.lang.String delimeter)
      Convert a byte array into a hexadecimal string.
      static java.lang.String convertBytesToString​(java.lang.Iterable<java.lang.Byte> bytes, java.lang.String delimiter)
      Convert a bytes into a hexadecimal string.
      static java.lang.String convertBytesToString​(java.util.Iterator<java.lang.Byte> bytes, java.lang.String delimiter)
      Convert a bytes into a hexadecimal string.
      static java.lang.String convertBytesToString​(java.util.stream.Stream<java.lang.Byte> bytes, java.lang.String delimiter)
      Convert a bytes into a hexadecimal string.
      static void convertHexStringToMaskedValue​(java.util.concurrent.atomic.AtomicLong msk, java.util.concurrent.atomic.AtomicLong val, java.lang.String hex, int n, int spaceevery, java.lang.String spacer)
      static java.lang.String convertMaskedValueToHexString​(long msk, long val, int n, boolean truncate, int spaceevery, java.lang.String spacer)
      Convert a masked value into a hexadecimal-ish string.
      static java.lang.String convertMaskToHexString​(long msk, int n, boolean truncate, int spaceevery, java.lang.String spacer)
      Convert a mask to a hexadecimal-ish string.
      static byte[] convertStringToBytes​(java.lang.String hexString)
      Parse hexadecimal digits into a byte array.
      static java.lang.String formatNumber​(long number, int radix)
      Render number in different bases using the default signedness mode.
      static java.lang.String formatNumber​(long number, int radix, SignednessFormatMode mode)
      Provide renderings of number in different bases: 0 - renders number as an escaped character sequence 2 - renders number as a base-2 integer 8 - renders number as a base-8 integer 10 - renders number as a base-10 integer 16 (default) - renders number as a base-16 integer Number Radix DEFAULT Mode Alias UNSIGNED Mode Value SIGNED Mode Value   100 2 UNSIGNED 1100100b 1100100b 100 8 UNSIGNED 144o 144o 100 10 SIGNED 100 100 100 16 UNSIGNED 64h 64h   -1 2 UNSIGNED 1111111111111111111111111111111111111111111111111111111111111111b -1b -1 8 UNSIGNED 1777777777777777777777o -1o -1 10 SIGNED 18446744073709551615 -1 -1 16 UNSIGNED ffffffffffffffffh -1h   -100 2 UNSIGNED 1111111111111111111111111111111111111111111111111111111110011100b -1100100b -100 8 UNSIGNED 1777777777777777777634o -144o -100 10 SIGNED 18446744073709551516 -100 -100 16 UNSIGNED ffffffffffffff9ch -64h
      static long getUnsignedAlignedValue​(long unsignedValue, long alignment)
      Get an unsigned aligned value corresponding to the specified unsigned value which will be greater than or equal the specified value.
      static boolean isFloatingPointType​(java.lang.Class<?> numClass)
      Determine if the provided Number class is a floating-point type.
      static boolean isFloatingPointType​(java.lang.Number number)
      Determine if the provided Number is a floating-point type -- Float or Double.
      static boolean isIntegerType​(java.lang.Class<?> numClass)
      Determine if the provided Number class is an integer type.
      static boolean isIntegerType​(java.lang.Number number)
      Determine if the provided Number is an integer type -- Byte, Short, Integer, or Long.
      static java.math.BigInteger parseHexBigInteger​(java.lang.String numStr)  
      static long parseHexLong​(java.lang.String numStr)  
      static long parseLong​(java.lang.String numStr)
      parses the given string as a numeric value, detecting whether or not it begins with a Hex prefix, and if not, parses as a long int value.
      static long parseNumber​(java.lang.String numStr)
      parses the given string as a numeric value, detecting whether or not it begins with a Hex prefix, and if not, parses as a long int value.
      static long parseOctLong​(java.lang.String numStr)
      parses the given string as a numeric value, detecting whether or not it begins with a Hex prefix, and if not, parses as a long int value.
      static java.lang.String toHexString​(long value)
      returns the value of the specified long as hexadecimal, prefixing with the HEX_PREFIX_x string.
      static java.lang.String toHexString​(long value, int size)
      returns the value of the specified long as hexadecimal, prefixing with the HEX_PREFIX_x string.
      static java.lang.String toSignedHexString​(long value)
      returns the value of the specified long as signed hexadecimal, prefixing with the HEX_PREFIX_x string.
      static java.lang.String toString​(byte b)
      Convert the given byte into a two character String, padding with a leading 0 if needed.
      static java.math.BigInteger unsignedLongToBigInteger​(long value)
      Converts a unsigned long value, which is currently stored in a java signed long, into a BigInteger.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MAX_UNSIGNED_LONG

        public static final java.math.BigInteger MAX_UNSIGNED_LONG
      • MAX_SIGNED_LONG

        public static final java.math.BigInteger MAX_SIGNED_LONG
      • MAX_UNSIGNED_INT32_AS_LONG NEW

        public static final long MAX_UNSIGNED_INT32_AS_LONG
        See Also:
        Constant Field Values

Method Detail