Class EndianNumbers
- java.lang.Object
-
- org.arakhne.afc.inputoutput.endian.EndianNumbers
-
public final class EndianNumbers extends Object
Utility methods for Little Endian Number coding.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:40
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- inputoutput
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
parseBEDouble(double value)
Converts a Java double to a Big Endian int on 8 bytes.static byte[]
parseBEFloat(float value)
Converts a Java float to a Big Endian int on 4 bytes.static byte[]
parseBEInt(int value)
Converts a Java int to a Big Endian int on 4 bytes.static byte[]
parseBELong(long value)
Converts a Java long to a Big Endian int on 8 bytes.static byte[]
parseBEShort(short value)
Converts a Java int to a Big Endian int on 2 bytes.static byte[]
parseLEDouble(double value)
Converts a Java double to a Little Endian int on 8 bytes.static byte[]
parseLEFloat(float value)
Converts a Java float to a Little Endian int on 4 bytes.static byte[]
parseLEInt(int value)
Converts a Java int to a Little Endian int on 4 bytes.static byte[]
parseLELong(long value)
Converts a Java long to a Little Endian int on 8 bytes.static byte[]
parseLEShort(short value)
Converts a Java int to a Little Endian int on 2 bytes.static double
toBEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8)
Converting eight bytes to a Big Endian double.static float
toBEFloat(int b1, int b2, int b3, int b4)
Converting four bytes to a Big Endian float.static int
toBEInt(int b1, int b2, int b3, int b4)
Converting four bytes to a Big Endian integer.static long
toBELong(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8)
Converting eight bytes to a Big Endian integer.static short
toBEShort(int b1, int b2)
Converting two bytes to a Big Endian short.static double
toLEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8)
Converting eight bytes to a Little Endian double.static float
toLEFloat(int b1, int b2, int b3, int b4)
Converting four bytes to a Little Endian float.static int
toLEInt(int b1, int b2, int b3, int b4)
Converting four bytes to a Little Endian integer.static long
toLELong(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8)
Converting eight bytes to a Little Endian integer.static short
toLEShort(int b1, int b2)
Converting two bytes to a Little Endian short.
-
-
-
Method Detail
-
toBEShort
@Pure public static short toBEShort(int b1, int b2)
Converting two bytes to a Big Endian short.- Parameters:
b1
- the first byte.b2
- the second byte.- Returns:
- the conversion result.
-
toLEShort
@Pure public static short toLEShort(int b1, int b2)
Converting two bytes to a Little Endian short.- Parameters:
b1
- the first byte.b2
- the second byte.- Returns:
- the conversion result
-
toLEInt
@Pure public static int toLEInt(int b1, int b2, int b3, int b4)
Converting four bytes to a Little Endian integer.- Parameters:
b1
- the first byte.b2
- the second byte.b3
- the third byte.b4
- the fourth byte.- Returns:
- the conversion result
-
toBEInt
@Pure public static int toBEInt(int b1, int b2, int b3, int b4)
Converting four bytes to a Big Endian integer.- Parameters:
b1
- the first byte.b2
- the second byte.b3
- the third byte.b4
- the fourth byte.- Returns:
- the conversion result
-
toLELong
@Pure public static long toLELong(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8)
Converting eight bytes to a Little Endian integer.- Parameters:
b1
- the first byte.b2
- the second byte.b3
- the third byte.b4
- the fourth byte.b5
- the fifth byte.b6
- the sixth byte.b7
- the seventh byte.b8
- the eighth byte.- Returns:
- the conversion result
-
toBELong
@Pure public static long toBELong(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8)
Converting eight bytes to a Big Endian integer.- Parameters:
b1
- the first byte.b2
- the second byte.b3
- the third byte.b4
- the fourth byte.b5
- the fifth byte.b6
- the sixth byte.b7
- the seventh byte.b8
- the eighth byte.- Returns:
- the conversion result
-
toLEDouble
@Pure public static double toLEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8)
Converting eight bytes to a Little Endian double.- Parameters:
b1
- the first byte.b2
- the second byte.b3
- the third byte.b4
- the fourth byte.b5
- the fifth byte.b6
- the sixth byte.b7
- the seventh byte.b8
- the eighth byte.- Returns:
- the conversion result
-
toBEDouble
@Pure public static double toBEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8)
Converting eight bytes to a Big Endian double.- Parameters:
b1
- the first byte.b2
- the second byte.b3
- the third byte.b4
- the fourth byte.b5
- the fifth byte.b6
- the sixth byte.b7
- the seventh byte.b8
- the eighth byte.- Returns:
- the conversion result
-
toLEFloat
@Pure public static float toLEFloat(int b1, int b2, int b3, int b4)
Converting four bytes to a Little Endian float.- Parameters:
b1
- the first byte.b2
- the second byte.b3
- the third byte.b4
- the fourth byte.- Returns:
- the conversion result
-
toBEFloat
@Pure public static float toBEFloat(int b1, int b2, int b3, int b4)
Converting four bytes to a Big Endian float.- Parameters:
b1
- the first byte.b2
- the second byte.b3
- the third byte.b4
- the fourth byte.- Returns:
- the conversion result
-
parseLEShort
@Pure public static byte[] parseLEShort(short value)
Converts a Java int to a Little Endian int on 2 bytes.- Parameters:
value
- is the value to parse.- Returns:
- the parsing result
-
parseLEInt
@Pure public static byte[] parseLEInt(int value)
Converts a Java int to a Little Endian int on 4 bytes.- Parameters:
value
- is the value to parse.- Returns:
- the parsing result
-
parseLEFloat
@Pure public static byte[] parseLEFloat(float value)
Converts a Java float to a Little Endian int on 4 bytes.- Parameters:
value
- is the value to parse.- Returns:
- the parsing result
-
parseLELong
@Pure public static byte[] parseLELong(long value)
Converts a Java long to a Little Endian int on 8 bytes.- Parameters:
value
- is the value to parse.- Returns:
- the parsing result
-
parseLEDouble
@Pure public static byte[] parseLEDouble(double value)
Converts a Java double to a Little Endian int on 8 bytes.- Parameters:
value
- is the value to parse.- Returns:
- the parsing result
-
parseBEShort
@Pure public static byte[] parseBEShort(short value)
Converts a Java int to a Big Endian int on 2 bytes.- Parameters:
value
- is the value to parse.- Returns:
- the parsing result
-
parseBEInt
@Pure public static byte[] parseBEInt(int value)
Converts a Java int to a Big Endian int on 4 bytes.- Parameters:
value
- is the value to parse.- Returns:
- the parsing result
-
parseBEFloat
@Pure public static byte[] parseBEFloat(float value)
Converts a Java float to a Big Endian int on 4 bytes.- Parameters:
value
- is the value to parse.- Returns:
- the parsing result
-
parseBELong
@Pure public static byte[] parseBELong(long value)
Converts a Java long to a Big Endian int on 8 bytes.- Parameters:
value
- is the value to parse.- Returns:
- the parsing result
-
parseBEDouble
@Pure public static byte[] parseBEDouble(double value)
Converts a Java double to a Big Endian int on 8 bytes.- Parameters:
value
- is the value to parse.- Returns:
- the parsing result
-
-