public class BinaryConversionUtils extends Object
Constructor and Description |
---|
BinaryConversionUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
bitToString(StringBuilder byteValue,
boolean bit)
Appends a logical 1 or 0 to the existing string based on the value of the bit
Used to convert a byte array to string.
|
static String |
byteArrayToString(byte[] byteArray,
String encoding)
Convert byte array to String.
|
static int |
convertByteArrayToInt(byte[] b)
Convert a byte array of size 4 bytes to type int
|
static long |
convertByteArrayToLong(byte[] b)
Convert a byte array of size 8 bytes to type long
|
static int |
convertLSBSigned(byte[] b,
int n)
Converts an array of bytes into an int.
|
static long |
convertLSBUnsigned(byte[] b,
int n) |
static long |
convertLSBUnsigned(int[] b,
int n) |
static int |
convertMSBSigned(byte[] b,
int n)
Converts an array of bytes into an int.
|
static long |
convertMSBUnsigned(byte[] b,
int n)
Converts an array of bytes into a long, permitting unsigned bytes.
|
static long |
convertMSBUnsigned(int[] b,
int n)
Converts an array of bytes into a long, permitting unsigned bytes.
|
static float |
LSBByteArrayToFloat(byte[] bytes)
convert LSB byte array (of size 4) to float
|
static float |
MSBByteArrayToFloat(byte[] bytes)
convert MSB byte array (of size 4) to float
|
static int |
pcReal4BTypeToIEEESingle(byte[] b)
Convert from PC_REAL type to IEEE single precision
|
static long |
pcReal8BTypeToIEEEDouble(byte[] b)
Convert from PC_REAL 8 Byte type to IEEE double precision
|
static long |
vaxDTypeToIEEEDouble(byte[] b)
Convert from VAX D-type to IEEE double precision.
|
static int |
vaxFTypeToIEEESingle(byte[] b)
Convert from VAX F-type 4-byte to IEEE single precision
|
static long |
vaxGTypeToIEEEDouble(byte[] b)
Convert from VAX G-type to IEEE 8-byte double precision
|
public static int convertMSBSigned(byte[] b, int n)
b
- the array of bytes, in big-endian ordern
- the number of bytes to convert in the array, from 1 to the
size of an intpublic static int convertLSBSigned(byte[] b, int n)
b
- the array of bytes, in little-endian ordern
- the number of bytes to convert in the array, from 1 to the
size of an intpublic static long convertMSBUnsigned(int[] b, int n)
b
- the array of bytes, in big-endian ordern
- the number of bytes to convert in the array, from 1 to the
size of an intpublic static long convertMSBUnsigned(byte[] b, int n)
b
- the array of bytes, in big-endian ordern
- the number of bytes to convert in the array, from 1 to the
size of an intpublic static long convertLSBUnsigned(int[] b, int n)
public static long convertLSBUnsigned(byte[] b, int n)
public static float MSBByteArrayToFloat(byte[] bytes)
test
- public static float LSBByteArrayToFloat(byte[] bytes)
test
- public static String byteArrayToString(byte[] byteArray, String encoding)
byteArray
- public static void bitToString(StringBuilder byteValue, boolean bit)
public static long convertByteArrayToLong(byte[] b)
b:
- byte array of size 8 bytespublic static int convertByteArrayToInt(byte[] b)
b:
- byte array if size 4 bytespublic static int vaxFTypeToIEEESingle(byte[] b)
b
- - byte array of size 4 bytespublic static long vaxDTypeToIEEEDouble(byte[] b)
b
- - byte array of size 8 bytespublic static long vaxGTypeToIEEEDouble(byte[] b)
b
- - byte array of size 8 bytespublic static int pcReal4BTypeToIEEESingle(byte[] b)
b
- - byte array of size 4 bytespublic static long pcReal8BTypeToIEEEDouble(byte[] b)
b
- - byte array of size 8 bytesCopyright © 2010–2018 Planetary Data System. All rights reserved.