Javadoc
diff --git a/src/main/java/org/apache/commons/lang3/Conversion.java b/src/main/java/org/apache/commons/lang3/Conversion.java
index aff2e7a..3ccc8c7 100644
--- a/src/main/java/org/apache/commons/lang3/Conversion.java
+++ b/src/main/java/org/apache/commons/lang3/Conversion.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.lang3;
import java.util.UUID;
@@ -34,81 +35,73 @@
* <li>int or intArray</li>
* <li>long or longArray</li>
* <li>hex: a String containing hexadecimal digits (lowercase in destination)</li>
- * <li>hexDigit: a Char containing a hexadecimal digit (lowercase in destination)</li>
+ * <li>hexDigit: a char containing a hexadecimal digit (lowercase in destination)</li>
* <li>uuid</li>
* </ul>
* <p>
- * Endianness field: little-endian is the default, in this case the field is absent. In case of
- * big-endian, the field is "Be".<br> Bit ordering: Lsb0 is the default, in this case the field
- * is absent. In case of Msb0, the field is "Msb0".
+ * Endianness field: little-endian is the default, in this case the field is absent. In case of big-endian, the field is "Be".<br>
+ * Bit ordering: Lsb0 is the default, in this case the field is absent. In case of Msb0, the field is "Msb0".
* </p>
* <p>
- * Example: intBeMsb0ToHex convert an int with big-endian byte order and Msb0 bit order into its
- * hexadecimal string representation
+ * Example: intBeMsb0ToHex convert an int with big-endian byte order and Msb0 bit order into its hexadecimal string representation
* </p>
* <p>
- * Most of the methods provide only default encoding for destination, this limits the number of
- * ways to do one thing. Unless you are dealing with data from/to outside of the JVM platform,
- * you should not need to use "Be" and "Msb0" methods.
+ * Most of the methods provide only default encoding for destination, this limits the number of ways to do one thing. Unless you are dealing with data from/to
+ * outside of the JVM platform, you should not need to use "Be" and "Msb0" methods.
* </p>
* <p>
- * Development status: work on going, only a part of the little-endian, Lsb0 methods implemented
- * so far.
+ * Development status: work on going, only a part of the little-endian, Lsb0 methods implemented so far.
* </p>
*
* @since 3.2
*/
public class Conversion {
- private static final boolean[] TTTT = {true, true, true, true};
- private static final boolean[] FTTT = {false, true, true, true};
- private static final boolean[] TFTT = {true, false, true, true};
- private static final boolean[] FFTT = {false, false, true, true};
- private static final boolean[] TTFT = {true, true, false, true};
- private static final boolean[] FTFT = {false, true, false, true};
- private static final boolean[] TFFT = {true, false, false, true};
- private static final boolean[] FFFT = {false, false, false, true};
- private static final boolean[] TTTF = {true, true, true, false};
- private static final boolean[] FTTF = {false, true, true, false};
- private static final boolean[] TFTF = {true, false, true, false};
- private static final boolean[] FFTF = {false, false, true, false};
- private static final boolean[] TTFF = {true, true, false, false};
- private static final boolean[] FTFF = {false, true, false, false};
- private static final boolean[] TFFF = {true, false, false, false};
- private static final boolean[] FFFF = {false, false, false, false};
+ private static final boolean[] TTTT = { true, true, true, true };
+ private static final boolean[] FTTT = { false, true, true, true };
+ private static final boolean[] TFTT = { true, false, true, true };
+ private static final boolean[] FFTT = { false, false, true, true };
+ private static final boolean[] TTFT = { true, true, false, true };
+ private static final boolean[] FTFT = { false, true, false, true };
+ private static final boolean[] TFFT = { true, false, false, true };
+ private static final boolean[] FFFT = { false, false, false, true };
+ private static final boolean[] TTTF = { true, true, true, false };
+ private static final boolean[] FTTF = { false, true, true, false };
+ private static final boolean[] TFTF = { true, false, true, false };
+ private static final boolean[] FFTF = { false, false, true, false };
+ private static final boolean[] TTFF = { true, true, false, false };
+ private static final boolean[] FTFF = { false, true, false, false };
+ private static final boolean[] TFFF = { true, false, false, false };
+ private static final boolean[] FFFF = { false, false, false, false };
/**
- * Converts the first 4 bits of a binary (represented as boolean array) in big-endian Msb0
- * bit ordering to a hexadecimal digit.
+ * Converts the first 4 bits of a binary (represented as boolean array) in big-endian Msb0 bit ordering to a hexadecimal digit.
*
* <p>
- * (1, 0, 0, 0) is converted as follow: '8' (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0) is converted
- * to '4'.
+ * (1, 0, 0, 0) is converted as follow: '8' (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0) is converted to '4'.
* </p>
*
* @param src the binary to convert.
* @return a hexadecimal digit representing the selected bits.
* @throws IllegalArgumentException if {@code src} is empty.
- * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws NullPointerException if {@code src} is {@code null}.
*/
public static char binaryBeMsb0ToHexDigit(final boolean[] src) {
return binaryBeMsb0ToHexDigit(src, 0);
}
/**
- * Converts a binary (represented as boolean array) in big-endian Msb0 bit ordering to a
- * hexadecimal digit.
+ * Converts a binary (represented as boolean array) in big-endian Msb0 bit ordering to a hexadecimal digit.
*
* <p>
- * (1, 0, 0, 0) with srcPos = 0 is converted as follow: '8' (1, 0, 0, 0, 0, 0, 0, 0,
- * 0, 0, 0, 1, 0, 1, 0, 0) with srcPos = 2 is converted to '5'.
+ * (1, 0, 0, 0) with srcPos = 0 is converted as follow: '8' (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0) with srcPos = 2 is converted to '5'.
* </p>
*
- * @param src the binary to convert.
+ * @param src the binary to convert.
* @param srcPos the position of the LSB to start the conversion.
* @return a hexadecimal digit representing the selected bits.
- * @throws IllegalArgumentException if {@code src} is empty.
- * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws IllegalArgumentException if {@code src} is empty.
+ * @throws NullPointerException if {@code src} is {@code null}.
* @throws IndexOutOfBoundsException if {@code srcPos} is outside the array.
*/
public static char binaryBeMsb0ToHexDigit(final boolean[] src, final int srcPos) {
@@ -147,7 +140,7 @@ public static char binaryBeMsb0ToHexDigit(final boolean[] src, final int srcPos)
}
/**
- * Converts binary (represented as boolean array) into a byte using the default (little endian, Lsb0) byte and bit ordering.
+ * Converts binary (represented as boolean array) into a byte using the default (little-endian, Lsb0) byte and bit ordering.
*
* @param src the binary to convert.
* @param srcPos the position in {@code src}, in boolean unit, from where to start the conversion.
@@ -159,8 +152,7 @@ public static char binaryBeMsb0ToHexDigit(final boolean[] src, final int srcPos)
* @throws IllegalArgumentException if {@code nBools-1+dstPos >= 8}.
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}.
*/
- public static byte binaryToByte(final boolean[] src, final int srcPos, final byte dstInit, final int dstPos,
- final int nBools) {
+ public static byte binaryToByte(final boolean[] src, final int srcPos, final byte dstInit, final int dstPos, final int nBools) {
if (src.length == 0 && srcPos == 0 || 0 == nBools) {
return dstInit;
}
@@ -178,35 +170,33 @@ public static byte binaryToByte(final boolean[] src, final int srcPos, final byt
}
/**
- * Converts binary (represented as boolean array) to a hexadecimal digit using the default
- * (Lsb0) bit ordering.
+ * Converts binary (represented as boolean array) to a hexadecimal digit using the default (Lsb0) bit ordering.
*
* <p>
- * (1, 0, 0, 0) is converted as follow: '1'
+ * (1, 0, 0, 0) is converted as follow: '1'.
* </p>
*
- * @param src the binary to convert
- * @return a hexadecimal digit representing the selected bits
- * @throws IllegalArgumentException if {@code src} is empty
- * @throws NullPointerException if {@code src} is {@code null}
+ * @param src the binary to convert.
+ * @return a hexadecimal digit representing the selected bits.
+ * @throws IllegalArgumentException if {@code src} is empty.
+ * @throws NullPointerException if {@code src} is {@code null}.
*/
public static char binaryToHexDigit(final boolean[] src) {
return binaryToHexDigit(src, 0);
}
/**
- * Converts binary (represented as boolean array) to a hexadecimal digit using the default
- * (Lsb0) bit ordering.
+ * Converts binary (represented as boolean array) to a hexadecimal digit using the default (Lsb0) bit ordering.
*
* <p>
- * (1, 0, 0, 0) is converted as follow: '1'
+ * (1, 0, 0, 0) is converted as follow: '1'.
* </p>
*
- * @param src the binary to convert
- * @param srcPos the position of the LSB to start the conversion
- * @return a hexadecimal digit representing the selected bits
- * @throws IllegalArgumentException if {@code src} is empty
- * @throws NullPointerException if {@code src} is {@code null}
+ * @param src the binary to convert.
+ * @param srcPos the position of the LSB to start the conversion.
+ * @return a hexadecimal digit representing the selected bits.
+ * @throws IllegalArgumentException if {@code src} is empty.
+ * @throws NullPointerException if {@code src} is {@code null}.
*/
public static char binaryToHexDigit(final boolean[] src, final int srcPos) {
if (src.length == 0) {
@@ -237,38 +227,33 @@ public static char binaryToHexDigit(final boolean[] src, final int srcPos) {
}
/**
- * Converts binary (represented as boolean array) to a hexadecimal digit using the Msb0 bit
- * ordering.
+ * Converts binary (represented as boolean array) to a hexadecimal digit using the Msb0 bit ordering.
*
* <p>
- * (1, 0, 0, 0) is converted as follow: '8'
+ * (1, 0, 0, 0) is converted as follow: '8'.
* </p>
*
- * @param src the binary to convert
- * @return a hexadecimal digit representing the selected bits
- * @throws IllegalArgumentException if {@code src} is empty, {@code src.length < 4} or
- * {@code src.length > 8}
- * @throws NullPointerException if {@code src} is {@code null}
+ * @param src the binary to convert.
+ * @return a hexadecimal digit representing the selected bits.
+ * @throws IllegalArgumentException if {@code src} is empty, {@code src.length < 4} or {@code src.length > 8}.
+ * @throws NullPointerException if {@code src} is {@code null}.
*/
public static char binaryToHexDigitMsb0_4bits(final boolean[] src) {
return binaryToHexDigitMsb0_4bits(src, 0);
}
/**
- * Converts binary (represented as boolean array) to a hexadecimal digit using the Msb0 bit
- * ordering.
+ * Converts binary (represented as boolean array) to a hexadecimal digit using the Msb0 bit ordering.
*
* <p>
- * (1, 0, 0, 0) is converted as follow: '8' (1, 0, 0, 1, 1, 0, 1, 0) with srcPos = 3 is converted
- * to 'D'
+ * (1, 0, 0, 0) is converted as follow: '8' (1, 0, 0, 1, 1, 0, 1, 0) with srcPos = 3 is converted to 'D'
* </p>
*
- * @param src the binary to convert
- * @param srcPos the position of the LSB to start the conversion
- * @return a hexadecimal digit representing the selected bits
- * @throws IllegalArgumentException if {@code src} is empty, {@code src.length > 8} or
- * {@code src.length - srcPos < 4}
- * @throws NullPointerException if {@code src} is {@code null}
+ * @param src the binary to convert.
+ * @param srcPos the position of the LSB to start the conversion.
+ * @return a hexadecimal digit representing the selected bits.
+ * @throws IllegalArgumentException if {@code src} is empty, {@code src.length > 8} or {@code src.length - srcPos < 4}.
+ * @throws NullPointerException if {@code src} is {@code null}.
*/
public static char binaryToHexDigitMsb0_4bits(final boolean[] src, final int srcPos) {
if (src.length > 8) {
@@ -302,22 +287,19 @@ public static char binaryToHexDigitMsb0_4bits(final boolean[] src, final int src
}
/**
- * Converts binary (represented as boolean array) into an int using the default (little
- * endian, Lsb0) byte and bit ordering.
+ * Converts binary (represented as boolean array) into an int using the default (little endian, Lsb0) byte and bit ordering.
*
- * @param src the binary to convert
- * @param srcPos the position in {@code src}, in boolean unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination int
- * @param dstPos the position of the LSB, in bits, in the result int
- * @param nBools the number of booleans to convert
- * @return an int containing the selected bits
- * @throws NullPointerException if {@code src} is {@code null}
- * @throws IllegalArgumentException if {@code nBools-1+dstPos >= 32}
- * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}
+ * @param src the binary to convert.
+ * @param srcPos the position in {@code src}, in boolean unit, from where to start the conversion.
+ * @param dstInit initial value of the destination int.
+ * @param dstPos the position of the LSB, in bits, in the result int.
+ * @param nBools the number of booleans to convert.
+ * @return an int containing the selected bits.
+ * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws IllegalArgumentException if {@code nBools-1+dstPos >= 32}.
+ * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}.
*/
- public static int binaryToInt(final boolean[] src, final int srcPos, final int dstInit, final int dstPos,
- final int nBools) {
+ public static int binaryToInt(final boolean[] src, final int srcPos, final int dstInit, final int dstPos, final int nBools) {
if (src.length == 0 && srcPos == 0 || 0 == nBools) {
return dstInit;
}
@@ -335,22 +317,19 @@ public static int binaryToInt(final boolean[] src, final int srcPos, final int d
}
/**
- * Converts binary (represented as boolean array) into a long using the default (little
- * endian, Lsb0) byte and bit ordering.
+ * Converts binary (represented as boolean array) into a long using the default (little endian, Lsb0) byte and bit ordering.
*
- * @param src the binary to convert
- * @param srcPos the position in {@code src}, in boolean unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination long
- * @param dstPos the position of the LSB, in bits, in the result long
- * @param nBools the number of booleans to convert
- * @return a long containing the selected bits
- * @throws NullPointerException if {@code src} is {@code null}
- * @throws IllegalArgumentException if {@code nBools-1+dstPos >= 64}
- * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}
+ * @param src the binary to convert.
+ * @param srcPos the position in {@code src}, in boolean unit, from where to start the conversion.
+ * @param dstInit initial value of the destination long.
+ * @param dstPos the position of the LSB, in bits, in the result long.
+ * @param nBools the number of booleans to convert.
+ * @return a long containing the selected bits.
+ * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws IllegalArgumentException if {@code nBools-1+dstPos >= 64}.
+ * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}.
*/
- public static long binaryToLong(final boolean[] src, final int srcPos, final long dstInit, final int dstPos,
- final int nBools) {
+ public static long binaryToLong(final boolean[] src, final int srcPos, final long dstInit, final int dstPos, final int nBools) {
if (src.length == 0 && srcPos == 0 || 0 == nBools) {
return dstInit;
}
@@ -368,22 +347,19 @@ public static long binaryToLong(final boolean[] src, final int srcPos, final lon
}
/**
- * Converts binary (represented as boolean array) into a short using the default (little
- * endian, Lsb0) byte and bit ordering.
+ * Converts binary (represented as boolean array) into a short using the default (little endian, Lsb0) byte and bit ordering.
*
- * @param src the binary to convert
- * @param srcPos the position in {@code src}, in boolean unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination short
- * @param dstPos the position of the LSB, in bits, in the result short
- * @param nBools the number of booleans to convert
- * @return a short containing the selected bits
- * @throws NullPointerException if {@code src} is {@code null}
- * @throws IllegalArgumentException if {@code nBools-1+dstPos >= 16}
- * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}
+ * @param src the binary to convert.
+ * @param srcPos the position in {@code src}, in boolean unit, from where to start the conversion.
+ * @param dstInit initial value of the destination short.
+ * @param dstPos the position of the LSB, in bits, in the result short.
+ * @param nBools the number of booleans to convert.
+ * @return a short containing the selected bits.
+ * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws IllegalArgumentException if {@code nBools-1+dstPos >= 16}.
+ * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}.
*/
- public static short binaryToShort(final boolean[] src, final int srcPos, final short dstInit, final int dstPos,
- final int nBools) {
+ public static short binaryToShort(final boolean[] src, final int srcPos, final short dstInit, final int dstPos, final int nBools) {
if (src.length == 0 && srcPos == 0 || 0 == nBools) {
return dstInit;
}
@@ -401,22 +377,19 @@ public static short binaryToShort(final boolean[] src, final int srcPos, final s
}
/**
- * Converts an array of byte into an int using the default (little-endian, Lsb0) byte and bit
- * ordering.
+ * Converts an array of byte into an int using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the byte array to convert
- * @param srcPos the position in {@code src}, in byte unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination int
- * @param dstPos the position of the LSB, in bits, in the result int
- * @param nBytes the number of bytes to convert
- * @return an int containing the selected bits
- * @throws NullPointerException if {@code src} is {@code null}
- * @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 32}
- * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}
+ * @param src the byte array to convert.
+ * @param srcPos the position in {@code src}, in byte unit, from where to start the conversion.
+ * @param dstInit initial value of the destination int.
+ * @param dstPos the position of the LSB, in bits, in the result int.
+ * @param nBytes the number of bytes to convert.
+ * @return an int containing the selected bits.
+ * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 32}.
+ * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}.
*/
- public static int byteArrayToInt(final byte[] src, final int srcPos, final int dstInit, final int dstPos,
- final int nBytes) {
+ public static int byteArrayToInt(final byte[] src, final int srcPos, final int dstInit, final int dstPos, final int nBytes) {
if (src.length == 0 && srcPos == 0 || 0 == nBytes) {
return dstInit;
}
@@ -434,22 +407,19 @@ public static int byteArrayToInt(final byte[] src, final int srcPos, final int d
}
/**
- * Converts an array of byte into a long using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts an array of byte into a long using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the byte array to convert
- * @param srcPos the position in {@code src}, in byte unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination long
- * @param dstPos the position of the LSB, in bits, in the result long
- * @param nBytes the number of bytes to convert
- * @return a long containing the selected bits
- * @throws NullPointerException if {@code src} is {@code null}
- * @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 64}
- * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}
+ * @param src the byte array to convert.
+ * @param srcPos the position in {@code src}, in byte unit, from where to start the conversion.
+ * @param dstInit initial value of the destination long.
+ * @param dstPos the position of the LSB, in bits, in the result long.
+ * @param nBytes the number of bytes to convert.
+ * @return a long containing the selected bits.
+ * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 64}.
+ * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}.
*/
- public static long byteArrayToLong(final byte[] src, final int srcPos, final long dstInit, final int dstPos,
- final int nBytes) {
+ public static long byteArrayToLong(final byte[] src, final int srcPos, final long dstInit, final int dstPos, final int nBytes) {
if (src.length == 0 && srcPos == 0 || 0 == nBytes) {
return dstInit;
}
@@ -467,22 +437,19 @@ public static long byteArrayToLong(final byte[] src, final int srcPos, final lon
}
/**
- * Converts an array of byte into a short using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts an array of byte into a short using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the byte array to convert
- * @param srcPos the position in {@code src}, in byte unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination short
- * @param dstPos the position of the LSB, in bits, in the result short
- * @param nBytes the number of bytes to convert
- * @return a short containing the selected bits
- * @throws NullPointerException if {@code src} is {@code null}
- * @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 16}
- * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}
+ * @param src the byte array to convert.
+ * @param srcPos the position in {@code src}, in byte unit, from where to start the conversion.
+ * @param dstInit initial value of the destination short.
+ * @param dstPos the position of the LSB, in bits, in the result short.
+ * @param nBytes the number of bytes to convert.
+ * @return a short containing the selected bits.
+ * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 16}.
+ * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}.
*/
- public static short byteArrayToShort(final byte[] src, final int srcPos, final short dstInit, final int dstPos,
- final int nBytes) {
+ public static short byteArrayToShort(final byte[] src, final int srcPos, final short dstInit, final int dstPos, final int nBytes) {
if (src.length == 0 && srcPos == 0 || 0 == nBytes) {
return dstInit;
}
@@ -500,15 +467,13 @@ public static short byteArrayToShort(final byte[] src, final int srcPos, final s
}
/**
- * Converts bytes from an array into a UUID using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts bytes from an array into a UUID using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the byte array to convert
- * @param srcPos the position in {@code src} where to copy the result from
- * @return a UUID
- * @throws NullPointerException if {@code src} is {@code null}
- * @throws IllegalArgumentException if array does not contain at least 16 bytes beginning
- * with {@code srcPos}
+ * @param src the byte array to convert.
+ * @param srcPos the position in {@code src} where to copy the result from.
+ * @return a UUID.
+ * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws IllegalArgumentException if array does not contain at least 16 bytes beginning with {@code srcPos}.
*/
public static UUID byteArrayToUuid(final byte[] src, final int srcPos) {
if (src.length - srcPos < 16) {
@@ -518,22 +483,19 @@ public static UUID byteArrayToUuid(final byte[] src, final int srcPos) {
}
/**
- * Converts a byte into an array of boolean using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts a byte into an array of boolean using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the byte to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dst the destination array
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nBools the number of booleans to copy to {@code dst}, must be smaller or equal to
- * the width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws NullPointerException if {@code dst} is {@code null}
- * @throws IllegalArgumentException if {@code nBools-1+srcPos >= 8}
- * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
+ * @param src the byte to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dst the destination array.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nBools the number of booleans to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws NullPointerException if {@code dst} is {@code null}.
+ * @throws IllegalArgumentException if {@code nBools-1+srcPos >= 8}.
+ * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}.
*/
- public static boolean[] byteToBinary(final byte src, final int srcPos, final boolean[] dst, final int dstPos,
- final int nBools) {
+ public static boolean[] byteToBinary(final byte src, final int srcPos, final boolean[] dst, final int dstPos, final int nBools) {
if (0 == nBools) {
return dst;
}
@@ -548,21 +510,18 @@ public static UUID byteArrayToUuid(final byte[] src, final int srcPos) {
}
/**
- * Converts a byte into an array of Char using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts a byte into an array of char using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the byte to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dstInit the initial value for the result String
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nHexs the number of chars to copy to {@code dst}, must be smaller or equal to the
- * width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 8}
- * @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}
+ * @param src the byte to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dstInit the initial value for the result String.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nHexs the number of chars to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 8}.
+ * @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}.
*/
- public static String byteToHex(final byte src, final int srcPos, final String dstInit, final int dstPos,
- final int nHexs) {
+ public static String byteToHex(final byte src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
if (0 == nHexs) {
return dstInit;
}
@@ -585,16 +544,15 @@ public static String byteToHex(final byte src, final int srcPos, final String ds
}
/**
- * Converts a hexadecimal digit into binary (represented as boolean array) using the Msb0
- * bit ordering.
+ * Converts a hexadecimal digit into binary (represented as boolean array) using the Msb0 bit ordering.
*
* <p>
- * '1' is converted as follow: (0, 0, 0, 1)
+ * '1' is converted as follow: (0, 0, 0, 1).
* </p>
*
- * @param hexDigit the hexadecimal digit to convert
- * @return a boolean array with the binary representation of {@code hexDigit}
- * @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
+ * @param hexDigit the hexadecimal digit to convert.
+ * @return a boolean array with the binary representation of {@code hexDigit}.
+ * @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit.
*/
public static boolean[] hexDigitMsb0ToBinary(final char hexDigit) {
switch (hexDigit) {
@@ -645,12 +603,12 @@ public static String byteToHex(final byte src, final int srcPos, final String ds
* Converts a hexadecimal digit into an int using the Msb0 bit ordering.
*
* <p>
- * '1' is converted to 8
+ * '1' is converted to 8.
* </p>
*
- * @param hexDigit the hexadecimal digit to convert
- * @return an int equals to {@code hexDigit}
- * @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
+ * @param hexDigit the hexadecimal digit to convert.
+ * @return an int equals to {@code hexDigit}.
+ * @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit.
*/
public static int hexDigitMsb0ToInt(final char hexDigit) {
switch (hexDigit) {
@@ -698,16 +656,15 @@ public static int hexDigitMsb0ToInt(final char hexDigit) {
}
/**
- * Converts a hexadecimal digit into binary (represented as boolean array) using the default
- * (Lsb0) bit ordering.
+ * Converts a hexadecimal digit into binary (represented as boolean array) using the default (Lsb0) bit ordering.
*
* <p>
- * '1' is converted as follow: (1, 0, 0, 0)
+ * '1' is converted as follow: (1, 0, 0, 0).
* </p>
*
- * @param hexDigit the hexadecimal digit to convert
- * @return a boolean array with the binary representation of {@code hexDigit}
- * @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
+ * @param hexDigit the hexadecimal digit to convert.
+ * @return a boolean array with the binary representation of {@code hexDigit}.
+ * @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit.
*/
public static boolean[] hexDigitToBinary(final char hexDigit) {
switch (hexDigit) {
@@ -761,9 +718,9 @@ public static int hexDigitMsb0ToInt(final char hexDigit) {
* '1' is converted to 1
* </p>
*
- * @param hexDigit the hexadecimal digit to convert
- * @return an int equals to {@code hexDigit}
- * @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
+ * @param hexDigit the hexadecimal digit to convert.
+ * @return an int equals to {@code hexDigit}.
+ * @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit.
*/
public static int hexDigitToInt(final char hexDigit) {
final int digit = Character.digit(hexDigit, 16);
@@ -776,14 +733,13 @@ public static int hexDigitToInt(final char hexDigit) {
/**
* Converts a hexadecimal string into a byte using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the hexadecimal string to convert
- * @param srcPos the position in {@code src}, in Char unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination byte
- * @param dstPos the position of the LSB, in bits, in the result byte
- * @param nHex the number of Chars to convert
- * @return a byte containing the selected bits
- * @throws IllegalArgumentException if {@code (nHex-1)*4+dstPos >= 8}
+ * @param src the hexadecimal string to convert.
+ * @param srcPos the position in {@code src}, in char unit, from where to start the conversion.
+ * @param dstInit initial value of the destination byte.
+ * @param dstPos the position of the LSB, in bits, in the result byte.
+ * @param nHex the number of Chars to convert.
+ * @return a byte containing the selected bits.
+ * @throws IllegalArgumentException if {@code (nHex-1)*4+dstPos >= 8}.
*/
public static byte hexToByte(final String src, final int srcPos, final byte dstInit, final int dstPos, final int nHex) {
if (0 == nHex) {
@@ -803,17 +759,15 @@ public static byte hexToByte(final String src, final int srcPos, final byte dstI
}
/**
- * Converts an array of Char into an int using the default (little-endian, Lsb0) byte and bit
- * ordering.
+ * Converts an array of char into an int using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the hexadecimal string to convert
- * @param srcPos the position in {@code src}, in char unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination int
- * @param dstPos the position of the LSB, in bits, in the result int
- * @param nHex the number of chars to convert
- * @return an int containing the selected bits
- * @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 32}
+ * @param src the hexadecimal string to convert.
+ * @param srcPos the position in {@code src}, in char unit, from where to start the conversion.
+ * @param dstInit initial value of the destination int.
+ * @param dstPos the position of the LSB, in bits, in the result int.
+ * @param nHex the number of chars to convert.
+ * @return an int containing the selected bits.
+ * @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 32}.
*/
public static int hexToInt(final String src, final int srcPos, final int dstInit, final int dstPos, final int nHex) {
if (0 == nHex) {
@@ -833,17 +787,15 @@ public static int hexToInt(final String src, final int srcPos, final int dstInit
}
/**
- * Converts an array of Char into a long using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts an array of char into a long using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the hexadecimal string to convert
- * @param srcPos the position in {@code src}, in char unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination long
- * @param dstPos the position of the LSB, in bits, in the result long
- * @param nHex the number of chars to convert
- * @return a long containing the selected bits
- * @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 64}
+ * @param src the hexadecimal string to convert.
+ * @param srcPos the position in {@code src}, in char unit, from where to start the conversion.
+ * @param dstInit initial value of the destination long.
+ * @param dstPos the position of the LSB, in bits, in the result long.
+ * @param nHex the number of chars to convert.
+ * @return a long containing the selected bits.
+ * @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 64}.
*/
public static long hexToLong(final String src, final int srcPos, final long dstInit, final int dstPos, final int nHex) {
if (0 == nHex) {
@@ -863,17 +815,15 @@ public static long hexToLong(final String src, final int srcPos, final long dstI
}
/**
- * Converts an array of Char into a short using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts an array of char into a short using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the hexadecimal string to convert
- * @param srcPos the position in {@code src}, in char unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination short
- * @param dstPos the position of the LSB, in bits, in the result short
- * @param nHex the number of chars to convert
- * @return a short containing the selected bits
- * @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 16}
+ * @param src the hexadecimal string to convert.
+ * @param srcPos the position in {@code src}, in char unit, from where to start the conversion.
+ * @param dstInit initial value of the destination short.
+ * @param dstPos the position of the LSB, in bits, in the result short.
+ * @param nHex the number of chars to convert.
+ * @return a short containing the selected bits.
+ * @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 16}.
*/
public static short hexToShort(final String src, final int srcPos, final short dstInit, final int dstPos, final int nHex) {
if (0 == nHex) {
@@ -893,22 +843,19 @@ public static short hexToShort(final String src, final int srcPos, final short d
}
/**
- * Converts an array of int into a long using the default (little-endian, Lsb0) byte and bit
- * ordering.
+ * Converts an array of int into a long using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the int array to convert
- * @param srcPos the position in {@code src}, in int unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination long
- * @param dstPos the position of the LSB, in bits, in the result long
- * @param nInts the number of ints to convert
- * @return a long containing the selected bits
- * @throws IllegalArgumentException if {@code (nInts-1)*32+dstPos >= 64}
- * @throws NullPointerException if {@code src} is {@code null}
- * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nInts > src.length}
+ * @param src the int array to convert.
+ * @param srcPos the position in {@code src}, in int unit, from where to start the conversion.
+ * @param dstInit initial value of the destination long.
+ * @param dstPos the position of the LSB, in bits, in the result long.
+ * @param nInts the number of ints to convert.
+ * @return a long containing the selected bits.
+ * @throws IllegalArgumentException if {@code (nInts-1)*32+dstPos >= 64}.
+ * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nInts > src.length}.
*/
- public static long intArrayToLong(final int[] src, final int srcPos, final long dstInit, final int dstPos,
- final int nInts) {
+ public static long intArrayToLong(final int[] src, final int srcPos, final long dstInit, final int dstPos, final int nInts) {
if (src.length == 0 && srcPos == 0 || 0 == nInts) {
return dstInit;
}
@@ -926,22 +873,19 @@ public static long intArrayToLong(final int[] src, final int srcPos, final long
}
/**
- * Converts an int into an array of boolean using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts an int into an array of boolean using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the int to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dst the destination array
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nBools the number of booleans to copy to {@code dst}, must be smaller or equal to
- * the width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws NullPointerException if {@code dst} is {@code null}
- * @throws IllegalArgumentException if {@code nBools-1+srcPos >= 32}
- * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
+ * @param src the int to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dst the destination array.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nBools the number of booleans to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws NullPointerException if {@code dst} is {@code null}.
+ * @throws IllegalArgumentException if {@code nBools-1+srcPos >= 32}.
+ * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}.
*/
- public static boolean[] intToBinary(final int src, final int srcPos, final boolean[] dst, final int dstPos,
- final int nBools) {
+ public static boolean[] intToBinary(final int src, final int srcPos, final boolean[] dst, final int dstPos, final int nBools) {
if (0 == nBools) {
return dst;
}
@@ -956,22 +900,19 @@ public static long intArrayToLong(final int[] src, final int srcPos, final long
}
/**
- * Converts an int into an array of byte using the default (little-endian, Lsb0) byte and bit
- * ordering.
+ * Converts an int into an array of byte using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the int to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dst the destination array
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nBytes the number of bytes to copy to {@code dst}, must be smaller or equal to the
- * width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws NullPointerException if {@code dst} is {@code null}
- * @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 32}
- * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
+ * @param src the int to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dst the destination array.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nBytes the number of bytes to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws NullPointerException if {@code dst} is {@code null}.
+ * @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 32}.
+ * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}.
*/
- public static byte[] intToByteArray(final int src, final int srcPos, final byte[] dst, final int dstPos,
- final int nBytes) {
+ public static byte[] intToByteArray(final int src, final int srcPos, final byte[] dst, final int dstPos, final int nBytes) {
if (0 == nBytes) {
return dst;
}
@@ -986,7 +927,7 @@ public static long intArrayToLong(final int[] src, final int srcPos, final long
}
/**
- * Converts an int into an array of Char using the default (little-endian, Lsb0) byte and bit ordering.
+ * Converts an int into an array of char using the default (little-endian, Lsb0) byte and bit ordering.
*
* @param src the int to convert.
* @param srcPos the position in {@code src}, in bits, from where to start the conversion.
@@ -997,8 +938,7 @@ public static long intArrayToLong(final int[] src, final int srcPos, final long
* @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 32}.
* @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}.
*/
- public static String intToHex(final int src, final int srcPos, final String dstInit, final int dstPos,
- final int nHexs) {
+ public static String intToHex(final int src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
if (0 == nHexs) {
return dstInit;
}
@@ -1033,9 +973,9 @@ public static String intToHex(final int src, final int srcPos, final String dstI
* 10 returns 'A' and so on...
* </p>
*
- * @param nibble the 4 bits to convert
- * @return a hexadecimal digit representing the 4 LSB of {@code nibble}
- * @throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}
+ * @param nibble the 4 bits to convert.
+ * @return a hexadecimal digit representing the 4 LSB of {@code nibble}.
+ * @throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}.
*/
public static char intToHexDigit(final int nibble) {
final char c = Character.forDigit(nibble, 16);
@@ -1058,9 +998,9 @@ public static char intToHexDigit(final int nibble) {
* 10 returns '5' and so on...
* </p>
*
- * @param nibble the 4 bits to convert
- * @return a hexadecimal digit representing the 4 LSB of {@code nibble}
- * @throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}
+ * @param nibble the 4 bits to convert.
+ * @return a hexadecimal digit representing the 4 LSB of {@code nibble}.
+ * @throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}.
*/
public static char intToHexDigitMsb0(final int nibble) {
switch (nibble) {
@@ -1102,22 +1042,19 @@ public static char intToHexDigitMsb0(final int nibble) {
}
/**
- * Converts an int into an array of short using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts an int into an array of short using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the int to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dst the destination array
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nShorts the number of shorts to copy to {@code dst}, must be smaller or equal to
- * the width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws NullPointerException if {@code dst} is {@code null}
- * @throws IllegalArgumentException if {@code (nShorts-1)*16+srcPos >= 32}
- * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nShorts > dst.length}
+ * @param src the int to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dst the destination array.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nShorts the number of shorts to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws NullPointerException if {@code dst} is {@code null}.
+ * @throws IllegalArgumentException if {@code (nShorts-1)*16+srcPos >= 32}.
+ * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nShorts > dst.length}.
*/
- public static short[] intToShortArray(final int src, final int srcPos, final short[] dst, final int dstPos,
- final int nShorts) {
+ public static short[] intToShortArray(final int src, final int srcPos, final short[] dst, final int dstPos, final int nShorts) {
if (0 == nShorts) {
return dst;
}
@@ -1132,22 +1069,19 @@ public static char intToHexDigitMsb0(final int nibble) {
}
/**
- * Converts a long into an array of boolean using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts a long into an array of boolean using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the long to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dst the destination array
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nBools the number of booleans to copy to {@code dst}, must be smaller or equal to
- * the width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws NullPointerException if {@code dst} is {@code null}
- * @throws IllegalArgumentException if {@code nBools-1+srcPos >= 64}
- * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
+ * @param src the long to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dst the destination array.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nBools the number of booleans to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws NullPointerException if {@code dst} is {@code null}.
+ * @throws IllegalArgumentException if {@code nBools-1+srcPos >= 64}.
+ * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}.
*/
- public static boolean[] longToBinary(final long src, final int srcPos, final boolean[] dst, final int dstPos,
- final int nBools) {
+ public static boolean[] longToBinary(final long src, final int srcPos, final boolean[] dst, final int dstPos, final int nBools) {
if (0 == nBools) {
return dst;
}
@@ -1162,22 +1096,19 @@ public static char intToHexDigitMsb0(final int nibble) {
}
/**
- * Converts a long into an array of byte using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts a long into an array of byte using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the long to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dst the destination array
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nBytes the number of bytes to copy to {@code dst}, must be smaller or equal to the
- * width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws NullPointerException if {@code dst} is {@code null}
- * @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 64}
- * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
+ * @param src the long to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dst the destination array.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nBytes the number of bytes to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws NullPointerException if {@code dst} is {@code null}.
+ * @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 64}.
+ * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}.
*/
- public static byte[] longToByteArray(final long src, final int srcPos, final byte[] dst, final int dstPos,
- final int nBytes) {
+ public static byte[] longToByteArray(final long src, final int srcPos, final byte[] dst, final int dstPos, final int nBytes) {
if (0 == nBytes) {
return dst;
}
@@ -1192,21 +1123,18 @@ public static char intToHexDigitMsb0(final int nibble) {
}
/**
- * Converts a long into an array of Char using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts a long into an array of char using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the long to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dstInit the initial value for the result String
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nHexs the number of chars to copy to {@code dst}, must be smaller or equal to the
- * width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 64}
- * @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}
+ * @param src the long to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dstInit the initial value for the result String.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nHexs the number of chars to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 64}.
+ * @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}.
*/
- public static String longToHex(final long src, final int srcPos, final String dstInit, final int dstPos,
- final int nHexs) {
+ public static String longToHex(final long src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
if (0 == nHexs) {
return dstInit;
}
@@ -1229,22 +1157,19 @@ public static String longToHex(final long src, final int srcPos, final String ds
}
/**
- * Converts a long into an array of int using the default (little-endian, Lsb0) byte and bit
- * ordering.
+ * Converts a long into an array of int using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the long to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dst the destination array
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nInts the number of ints to copy to {@code dst}, must be smaller or equal to the
- * width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws NullPointerException if {@code dst} is {@code null} and {@code nInts > 0}
- * @throws IllegalArgumentException if {@code (nInts-1)*32+srcPos >= 64}
- * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nInts > dst.length}
+ * @param src the long to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dst the destination array.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nInts the number of ints to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws NullPointerException if {@code dst} is {@code null} and {@code nInts > 0}.
+ * @throws IllegalArgumentException if {@code (nInts-1)*32+srcPos >= 64}.
+ * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nInts > dst.length}.
*/
- public static int[] longToIntArray(final long src, final int srcPos, final int[] dst, final int dstPos,
- final int nInts) {
+ public static int[] longToIntArray(final long src, final int srcPos, final int[] dst, final int dstPos, final int nInts) {
if (0 == nInts) {
return dst;
}
@@ -1259,22 +1184,19 @@ public static String longToHex(final long src, final int srcPos, final String ds
}
/**
- * Converts a long into an array of short using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts a long into an array of short using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the long to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dst the destination array
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nShorts the number of shorts to copy to {@code dst}, must be smaller or equal to
- * the width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws NullPointerException if {@code dst} is {@code null}
- * @throws IllegalArgumentException if {@code (nShorts-1)*16+srcPos >= 64}
- * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nShorts > dst.length}
+ * @param src the long to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dst the destination array.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nShorts the number of shorts to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws NullPointerException if {@code dst} is {@code null}.
+ * @throws IllegalArgumentException if {@code (nShorts-1)*16+srcPos >= 64}.
+ * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nShorts > dst.length}.
*/
- public static short[] longToShortArray(final long src, final int srcPos, final short[] dst, final int dstPos,
- final int nShorts) {
+ public static short[] longToShortArray(final long src, final int srcPos, final short[] dst, final int dstPos, final int nShorts) {
if (0 == nShorts) {
return dst;
}
@@ -1289,22 +1211,19 @@ public static String longToHex(final long src, final int srcPos, final String ds
}
/**
- * Converts an array of short into an int using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts an array of short into an int using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the short array to convert
- * @param srcPos the position in {@code src}, in short unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination int
- * @param dstPos the position of the LSB, in bits, in the result int
- * @param nShorts the number of shorts to convert
- * @return an int containing the selected bits
- * @throws NullPointerException if {@code src} is {@code null}
- * @throws IllegalArgumentException if {@code (nShorts-1)*16+dstPos >= 32}
- * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nShorts > src.length}
+ * @param src the short array to convert.
+ * @param srcPos the position in {@code src}, in short unit, from where to start the conversion.
+ * @param dstInit initial value of the destination int.
+ * @param dstPos the position of the LSB, in bits, in the result int.
+ * @param nShorts the number of shorts to convert.
+ * @return an int containing the selected bits.
+ * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws IllegalArgumentException if {@code (nShorts-1)*16+dstPos >= 32}.
+ * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nShorts > src.length}.
*/
- public static int shortArrayToInt(final short[] src, final int srcPos, final int dstInit, final int dstPos,
- final int nShorts) {
+ public static int shortArrayToInt(final short[] src, final int srcPos, final int dstInit, final int dstPos, final int nShorts) {
if (src.length == 0 && srcPos == 0 || 0 == nShorts) {
return dstInit;
}
@@ -1322,22 +1241,19 @@ public static int shortArrayToInt(final short[] src, final int srcPos, final int
}
/**
- * Converts an array of short into a long using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts an array of short into a long using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the short array to convert
- * @param srcPos the position in {@code src}, in short unit, from where to start the
- * conversion
- * @param dstInit initial value of the destination long
- * @param dstPos the position of the LSB, in bits, in the result long
- * @param nShorts the number of shorts to convert
- * @return a long containing the selected bits
- * @throws NullPointerException if {@code src} is {@code null}
- * @throws IllegalArgumentException if {@code (nShorts-1)*16+dstPos >= 64}
- * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nShorts > src.length}
+ * @param src the short array to convert.
+ * @param srcPos the position in {@code src}, in short unit, from where to start the conversion.
+ * @param dstInit initial value of the destination long.
+ * @param dstPos the position of the LSB, in bits, in the result long.
+ * @param nShorts the number of shorts to convert.
+ * @return a long containing the selected bits.
+ * @throws NullPointerException if {@code src} is {@code null}.
+ * @throws IllegalArgumentException if {@code (nShorts-1)*16+dstPos >= 64}.
+ * @throws ArrayIndexOutOfBoundsException if {@code srcPos + nShorts > src.length}.
*/
- public static long shortArrayToLong(final short[] src, final int srcPos, final long dstInit, final int dstPos,
- final int nShorts) {
+ public static long shortArrayToLong(final short[] src, final int srcPos, final long dstInit, final int dstPos, final int nShorts) {
if (src.length == 0 && srcPos == 0 || 0 == nShorts) {
return dstInit;
}
@@ -1355,22 +1271,19 @@ public static long shortArrayToLong(final short[] src, final int srcPos, final l
}
/**
- * Converts a short into an array of boolean using the default (little-endian, Lsb0) byte
- * and bit ordering.
+ * Converts a short into an array of boolean using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the short to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dst the destination array
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nBools the number of booleans to copy to {@code dst}, must be smaller or equal to
- * the width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws NullPointerException if {@code dst} is {@code null}
- * @throws IllegalArgumentException if {@code nBools-1+srcPos >= 16}
- * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
+ * @param src the short to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dst the destination array.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nBools the number of booleans to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws NullPointerException if {@code dst} is {@code null}.
+ * @throws IllegalArgumentException if {@code nBools-1+srcPos >= 16}.
+ * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}.
*/
- public static boolean[] shortToBinary(final short src, final int srcPos, final boolean[] dst, final int dstPos,
- final int nBools) {
+ public static boolean[] shortToBinary(final short src, final int srcPos, final boolean[] dst, final int dstPos, final int nBools) {
if (0 == nBools) {
return dst;
}
@@ -1386,22 +1299,19 @@ public static long shortArrayToLong(final short[] src, final int srcPos, final l
}
/**
- * Converts a short into an array of byte using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts a short into an array of byte using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the short to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dst the destination array
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nBytes the number of bytes to copy to {@code dst}, must be smaller or equal to the
- * width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws NullPointerException if {@code dst} is {@code null}
- * @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 16}
- * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
+ * @param src the short to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dst the destination array.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nBytes the number of bytes to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws NullPointerException if {@code dst} is {@code null}.
+ * @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 16}.
+ * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}.
*/
- public static byte[] shortToByteArray(final short src, final int srcPos, final byte[] dst, final int dstPos,
- final int nBytes) {
+ public static byte[] shortToByteArray(final short src, final int srcPos, final byte[] dst, final int dstPos, final int nBytes) {
if (0 == nBytes) {
return dst;
}
@@ -1416,21 +1326,18 @@ public static long shortArrayToLong(final short[] src, final int srcPos, final l
}
/**
- * Converts a short into an array of Char using the default (little-endian, Lsb0) byte and
- * bit ordering.
+ * Converts a short into an array of char using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the short to convert
- * @param srcPos the position in {@code src}, in bits, from where to start the conversion
- * @param dstInit the initial value for the result String
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nHexs the number of chars to copy to {@code dst}, must be smaller or equal to the
- * width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 16}
- * @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}
+ * @param src the short to convert.
+ * @param srcPos the position in {@code src}, in bits, from where to start the conversion.
+ * @param dstInit the initial value for the result String.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nHexs the number of chars to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 16}.
+ * @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}.
*/
- public static String shortToHex(final short src, final int srcPos, final String dstInit, final int dstPos,
- final int nHexs) {
+ public static String shortToHex(final short src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
if (0 == nHexs) {
return dstInit;
}
@@ -1453,18 +1360,16 @@ public static String shortToHex(final short src, final int srcPos, final String
}
/**
- * Converts UUID into an array of byte using the default (little-endian, Lsb0) byte and bit
- * ordering.
+ * Converts UUID into an array of byte using the default (little-endian, Lsb0) byte and bit ordering.
*
- * @param src the UUID to convert
- * @param dst the destination array
- * @param dstPos the position in {@code dst} where to copy the result
- * @param nBytes the number of bytes to copy to {@code dst}, must be smaller or equal to the
- * width of the input (from srcPos to MSB)
- * @return {@code dst}
- * @throws NullPointerException if {@code dst} is {@code null}
- * @throws IllegalArgumentException if {@code nBytes > 16}
- * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
+ * @param src the UUID to convert.
+ * @param dst the destination array.
+ * @param dstPos the position in {@code dst} where to copy the result.
+ * @param nBytes the number of bytes to copy to {@code dst}, must be smaller or equal to the width of the input (from srcPos to MSB).
+ * @return {@code dst}.
+ * @throws NullPointerException if {@code dst} is {@code null}.
+ * @throws IllegalArgumentException if {@code nBytes > 16}.
+ * @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}.
*/
public static byte[] uuidToByteArray(final UUID src, final byte[] dst, final int dstPos, final int nBytes) {
if (0 == nBytes) {