@InterfaceAudience.Private public class BytesUtil extends Object
| Constructor and Description | 
|---|
| BytesUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static byte[] | toBytes(boolean b)Convert a boolean to a byte array. | 
| static byte[] | toBytes(double d)Serialize a double as the IEEE 754 double format output. | 
| static byte[] | toBytes(float f) | 
| static double | toDouble(byte[] bytes) | 
| static double | toDouble(byte[] bytes,
        int offset) | 
| static float | toFloat(byte[] bytes)Presumes float encoded as IEEE 754 floating-point "single format" | 
| static float | toFloat(byte[] bytes,
       int offset)Presumes float encoded as IEEE 754 floating-point "single format" | 
| static int | toInt(byte[] bytes,
     int offset)Convert a big-endian integer from a byte array to a primitive value. | 
| static long | toLong(byte[] bytes,
      int offset)Converts a big-endian byte array to a long value. | 
| static String | toStringBinary(byte[] b)Write a printable representation of a byte array. | 
| static String | toStringBinary(byte[] b,
              int off,
              int len)Write a printable representation of a byte array. | 
public static long toLong(byte[] bytes,
                          int offset)
bytes - array of bytesoffset - offset into arraypublic static int toInt(byte[] bytes,
                        int offset)
bytes - the array to parse fromoffset - the offset in the arraypublic static float toFloat(byte[] bytes)
bytes - byte arraypublic static float toFloat(byte[] bytes,
                            int offset)
bytes - array to convertoffset - offset into arraypublic static double toDouble(byte[] bytes)
bytes - byte arraypublic static double toDouble(byte[] bytes,
                              int offset)
bytes - byte arrayoffset - offset where double ispublic static String toStringBinary(byte[] b)
b - byte arraytoStringBinary(byte[], int, int)public static String toStringBinary(byte[] b, int off, int len)
b - array to write outoff - offset to start atlen - length to writepublic static byte[] toBytes(boolean b)
b - valueb encoded in a byte array.public static byte[] toBytes(float f)
f - float valuepublic static byte[] toBytes(double d)
d - valueCopyright © 2008–2023 Apache Software Foundation. All rights reserved.