Package nxt.util

Class Convert

java.lang.Object
nxt.util.Convert

public final class Convert extends Object
  • Field Details

    • two64

      public static final BigInteger two64
    • EMPTY_LONG

      public static final long[] EMPTY_LONG
    • EMPTY_BYTE

      public static final byte[] EMPTY_BYTE
    • EMPTY_BYTES

      public static final byte[][] EMPTY_BYTES
    • byteArrayComparator

      public static final Comparator<byte[]> byteArrayComparator
  • Method Details

    • parseHexString

      public static byte[] parseHexString(String hex)
    • toHexString

      public static String toHexString(byte[] bytes)
    • parseUnsignedLong

      public static long parseUnsignedLong(String number)
    • parseInt

      public static int parseInt(Object o)
    • parseLong

      public static long parseLong(Object o)
    • parseAccountId

      public static long parseAccountId(String account)
    • rsAccount

      public static String rsAccount(long accountId)
    • rsEncode

      public static String rsEncode(long id)
    • rsDecode

      public static long rsDecode(String rsString)
    • fullHashToId

      public static long fullHashToId(byte[] hash)
    • fromEpochTime

      public static long fromEpochTime(int epochTime)
    • toEpochTime

      public static int toEpochTime(long currentTime)
    • emptyToNull

      public static String emptyToNull(String s)
    • nullToEmpty

      public static String nullToEmpty(String s)
    • emptyToNull

      public static byte[] emptyToNull(byte[] bytes)
    • nullToEmpty

      public static byte[][] nullToEmpty(byte[][] bytes)
    • nullToEmpty

      public static long[] nullToEmpty(long[] array)
    • nullToZero

      public static long nullToZero(Long l)
    • toArray

      public static long[] toArray(List<Long> list)
    • toList

      public static List<Long> toList(long[] array)
    • toArray

      public static Long[] toArray(long[] array)
    • toArray

      public static long[] toArray(Long[] array)
    • toSet

      public static Set<Long> toSet(long[] array)
    • toBytes

      public static byte[] toBytes(String s)
    • toBytes

      public static byte[] toBytes(String s, boolean isText)
    • toString

      public static String toString(byte[] bytes)
    • toString

      public static String toString(byte[] bytes, boolean isText)
    • toBytes

      public static byte[] toBytes(long n)
    • readString

      public static String readString(ByteBuffer buffer, int numBytes, int maxLength) throws NxtException.NotValidException
      Throws:
      NxtException.NotValidException
    • getMaxStringSize

      public static int getMaxStringSize(int length)
    • truncate

      public static String truncate(String s, String replaceNull, int limit, boolean dots)
    • decimalMultiplier

      public static long decimalMultiplier(int decimals)
    • compress

      public static byte[] compress(byte[] bytes)
    • uncompress

      public static byte[] uncompress(byte[] bytes)
    • unitRateToAmount

      public static long unitRateToAmount(long unitsQNT, int unitsDecimals, long rateNQT, int rateDecimals)
    • longToBytes

      public static byte[] longToBytes(long l)
    • bytesToLong

      public static long bytesToLong(byte[] b)
    • longValueExact

      public static long longValueExact(BigInteger bigInteger)
    • pkcs7Pad

      public static byte[] pkcs7Pad(byte[] plaintext)
    • pkcs7Unpad

      public static byte[] pkcs7Unpad(byte[] padded)
    • toSignedBytes

      public static byte[] toSignedBytes(short[] s)
    • toUnsignedBytes

      public static short[] toUnsignedBytes(byte[] b)
    • intToLittleEndian

      public static byte[] intToLittleEndian(int pathComponent)
    • switchEndian

      public static byte[] switchEndian(byte[] b)
      Converts an array in place from big to little endian and vice versa
      Parameters:
      b - input/output array modified in place, use Arrays.copy() when calling to avoid modification
      Returns:
      the converted array
    • isUtf8Text

      public static boolean isUtf8Text(byte[] message)
    • bigIntegerToHexString

      public static String bigIntegerToHexString(BigInteger bigInteger, int expectedLength)
    • toBigDecimal

      public static BigDecimal toBigDecimal(long amount, byte decimals)