From 7b33ab10def0b53d8d04c6590f7f5f5be3025085 Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Fri, 27 Jun 2014 13:03:13 +0000 Subject: [PATCH] Format to 120 line length. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1606081 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/lang3/Conversion.java | 239 ++++++++---------- 1 file changed, 109 insertions(+), 130 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/Conversion.java b/src/main/java/org/apache/commons/lang3/Conversion.java index 187de8ac9..3c9ce8d9f 100644 --- a/src/main/java/org/apache/commons/lang3/Conversion.java +++ b/src/main/java/org/apache/commons/lang3/Conversion.java @@ -156,9 +156,7 @@ public class Conversion { case 'F': return 0xF; default: - throw new IllegalArgumentException("Cannot interpret '" - + hexDigit - + "' as a hexadecimal digit"); + throw new IllegalArgumentException("Cannot interpret '" + hexDigit + "' as a hexadecimal digit"); } } @@ -216,9 +214,7 @@ public class Conversion { case 'F': return TTTT; default: - throw new IllegalArgumentException("Cannot interpret '" - + hexDigit - + "' as a hexadecimal digit"); + throw new IllegalArgumentException("Cannot interpret '" + hexDigit + "' as a hexadecimal digit"); } } @@ -276,9 +272,7 @@ public class Conversion { case 'F': return TTTT; default: - throw new IllegalArgumentException("Cannot interpret '" - + hexDigit - + "' as a hexadecimal digit"); + throw new IllegalArgumentException("Cannot interpret '" + hexDigit + "' as a hexadecimal digit"); } } @@ -579,17 +573,17 @@ public class Conversion { * @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; } if ((nInts - 1) * 32 + dstPos >= 64) { - throw new IllegalArgumentException( - "(nInts-1)*32+dstPos is greather or equal to than 64"); + throw new IllegalArgumentException("(nInts-1)*32+dstPos is greather or equal to than 64"); } long out = dstInit; int shift = 0; - for (int i = 0; i < nInts; i++ ) { + for (int i = 0; i < nInts; i++) { shift = i * 32 + dstPos; final long bits = ((0xffffffffL & src[i + srcPos]) << shift); final long mask = 0xffffffffL << shift; @@ -616,17 +610,16 @@ public class Conversion { * @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) { + final int nShorts) { if ((src.length == 0 && srcPos == 0) || 0 == nShorts) { return dstInit; } if ((nShorts - 1) * 16 + dstPos >= 64) { - throw new IllegalArgumentException( - "(nShorts-1)*16+dstPos is greather or equal to than 64"); + throw new IllegalArgumentException("(nShorts-1)*16+dstPos is greather or equal to than 64"); } long out = dstInit; int shift = 0; - for (int i = 0; i < nShorts; i++ ) { + for (int i = 0; i < nShorts; i++) { shift = i * 16 + dstPos; final long bits = (0xffffL & src[i + srcPos]) << shift; final long mask = 0xffffL << shift; @@ -653,17 +646,16 @@ public class Conversion { * @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) { + final int nShorts) { if ((src.length == 0 && srcPos == 0) || 0 == nShorts) { return dstInit; } if ((nShorts - 1) * 16 + dstPos >= 32) { - throw new IllegalArgumentException( - "(nShorts-1)*16+dstPos is greather or equal to than 32"); + throw new IllegalArgumentException("(nShorts-1)*16+dstPos is greather or equal to than 32"); } int out = dstInit; int shift = 0; - for (int i = 0; i < nShorts; i++ ) { + for (int i = 0; i < nShorts; i++) { shift = i * 16 + dstPos; final int bits = (0xffff & src[i + srcPos]) << shift; final int mask = 0xffff << shift; @@ -690,17 +682,16 @@ public class Conversion { * @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) { + final int nBytes) { if ((src.length == 0 && srcPos == 0) || 0 == nBytes) { return dstInit; } if ((nBytes - 1) * 8 + dstPos >= 64) { - throw new IllegalArgumentException( - "(nBytes-1)*8+dstPos is greather or equal to than 64"); + throw new IllegalArgumentException("(nBytes-1)*8+dstPos is greather or equal to than 64"); } long out = dstInit; int shift = 0; - for (int i = 0; i < nBytes; i++ ) { + for (int i = 0; i < nBytes; i++) { shift = i * 8 + dstPos; final long bits = (0xffL & src[i + srcPos]) << shift; final long mask = 0xffL << shift; @@ -726,17 +717,17 @@ public class Conversion { * @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; } if ((nBytes - 1) * 8 + dstPos >= 32) { - throw new IllegalArgumentException( - "(nBytes-1)*8+dstPos is greather or equal to than 32"); + throw new IllegalArgumentException("(nBytes-1)*8+dstPos is greather or equal to than 32"); } int out = dstInit; int shift = 0; - for (int i = 0; i < nBytes; i++ ) { + for (int i = 0; i < nBytes; i++) { shift = i * 8 + dstPos; final int bits = (0xff & src[i + srcPos]) << shift; final int mask = 0xff << shift; @@ -763,21 +754,20 @@ public class Conversion { * @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) { + final int nBytes) { if ((src.length == 0 && srcPos == 0) || 0 == nBytes) { return dstInit; } if ((nBytes - 1) * 8 + dstPos >= 16) { - throw new IllegalArgumentException( - "(nBytes-1)*8+dstPos is greather or equal to than 16"); + throw new IllegalArgumentException("(nBytes-1)*8+dstPos is greather or equal to than 16"); } short out = dstInit; int shift = 0; - for (int i = 0; i < nBytes; i++ ) { + for (int i = 0; i < nBytes; i++) { shift = i * 8 + dstPos; final int bits = (0xff & src[i + srcPos]) << shift; final int mask = 0xff << shift; - out = (short)((out & ~mask) | bits); + out = (short) ((out & ~mask) | bits); } return out; } @@ -797,17 +787,17 @@ public class Conversion { * @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) { + public static long hexToLong(final String src, final int srcPos, final long dstInit, final int dstPos, + final int nHex) { if (0 == nHex) { return dstInit; } if ((nHex - 1) * 4 + dstPos >= 64) { - throw new IllegalArgumentException( - "(nHexs-1)*4+dstPos is greather or equal to than 64"); + throw new IllegalArgumentException("(nHexs-1)*4+dstPos is greather or equal to than 64"); } long out = dstInit; int shift = 0; - for (int i = 0; i < nHex; i++ ) { + for (int i = 0; i < nHex; i++) { shift = i * 4 + dstPos; final long bits = (0xfL & hexDigitToInt(src.charAt(i + srcPos))) << shift; final long mask = 0xfL << shift; @@ -836,12 +826,11 @@ public class Conversion { return dstInit; } if ((nHex - 1) * 4 + dstPos >= 32) { - throw new IllegalArgumentException( - "(nHexs-1)*4+dstPos is greather or equal to than 32"); + throw new IllegalArgumentException("(nHexs-1)*4+dstPos is greather or equal to than 32"); } int out = dstInit; int shift = 0; - for (int i = 0; i < nHex; i++ ) { + for (int i = 0; i < nHex; i++) { shift = i * 4 + dstPos; final int bits = (0xf & hexDigitToInt(src.charAt(i + srcPos))) << shift; final int mask = 0xf << shift; @@ -865,21 +854,21 @@ public class Conversion { * @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) { + public static short hexToShort(final String src, final int srcPos, final short dstInit, final int dstPos, + final int nHex) { if (0 == nHex) { return dstInit; } if ((nHex - 1) * 4 + dstPos >= 16) { - throw new IllegalArgumentException( - "(nHexs-1)*4+dstPos is greather or equal to than 16"); + throw new IllegalArgumentException("(nHexs-1)*4+dstPos is greather or equal to than 16"); } short out = dstInit; int shift = 0; - for (int i = 0; i < nHex; i++ ) { + for (int i = 0; i < nHex; i++) { shift = i * 4 + dstPos; final int bits = (0xf & hexDigitToInt(src.charAt(i + srcPos))) << shift; final int mask = 0xf << shift; - out = (short)((out & ~mask) | bits); + out = (short) ((out & ~mask) | bits); } return out; } @@ -899,21 +888,21 @@ public class Conversion { * @return a byte containing the selected bits * @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 8} */ - public static byte hexToByte(final String src, final int srcPos, final byte dstInit, final int dstPos, final int nHex) { + public static byte hexToByte(final String src, final int srcPos, final byte dstInit, final int dstPos, + final int nHex) { if (0 == nHex) { return dstInit; } if ((nHex - 1) * 4 + dstPos >= 8) { - throw new IllegalArgumentException( - "(nHexs-1)*4+dstPos is greather or equal to than 8"); + throw new IllegalArgumentException("(nHexs-1)*4+dstPos is greather or equal to than 8"); } byte out = dstInit; int shift = 0; - for (int i = 0; i < nHex; i++ ) { + for (int i = 0; i < nHex; i++) { shift = i * 4 + dstPos; final int bits = (0xf & hexDigitToInt(src.charAt(i + srcPos))) << shift; final int mask = 0xf << shift; - out = (byte)((out & ~mask) | bits); + out = (byte) ((out & ~mask) | bits); } return out; } @@ -936,17 +925,16 @@ public class Conversion { * @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) { + final int nBools) { if ((src.length == 0 && srcPos == 0) || 0 == nBools) { return dstInit; } if (nBools - 1 + dstPos >= 64) { - throw new IllegalArgumentException( - "nBools-1+dstPos is greather or equal to than 64"); + throw new IllegalArgumentException("nBools-1+dstPos is greather or equal to than 64"); } long out = dstInit; int shift = 0; - for (int i = 0; i < nBools; i++ ) { + for (int i = 0; i < nBools; i++) { shift = i + dstPos; final long bits = (src[i + srcPos] ? 1L : 0) << shift; final long mask = 0x1L << shift; @@ -972,17 +960,17 @@ public class Conversion { * @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; } if (nBools - 1 + dstPos >= 32) { - throw new IllegalArgumentException( - "nBools-1+dstPos is greather or equal to than 32"); + throw new IllegalArgumentException("nBools-1+dstPos is greather or equal to than 32"); } int out = dstInit; int shift = 0; - for (int i = 0; i < nBools; i++ ) { + for (int i = 0; i < nBools; i++) { shift = i + dstPos; final int bits = (src[i + srcPos] ? 1 : 0) << shift; final int mask = 0x1 << shift; @@ -1009,21 +997,20 @@ public class Conversion { * @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) { + final int nBools) { if ((src.length == 0 && srcPos == 0) || 0 == nBools) { return dstInit; } if (nBools - 1 + dstPos >= 16) { - throw new IllegalArgumentException( - "nBools-1+dstPos is greather or equal to than 16"); + throw new IllegalArgumentException("nBools-1+dstPos is greather or equal to than 16"); } short out = dstInit; int shift = 0; - for (int i = 0; i < nBools; i++ ) { + for (int i = 0; i < nBools; i++) { shift = i + dstPos; final int bits = (src[i + srcPos] ? 1 : 0) << shift; final int mask = 0x1 << shift; - out = (short)((out & ~mask) | bits); + out = (short) ((out & ~mask) | bits); } return out; } @@ -1046,7 +1033,7 @@ public class Conversion { * @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) { + final int nBools) { if ((src.length == 0 && srcPos == 0) || 0 == nBools) { return dstInit; } @@ -1055,11 +1042,11 @@ public class Conversion { } byte out = dstInit; int shift = 0; - for (int i = 0; i < nBools; i++ ) { + for (int i = 0; i < nBools; i++) { shift = i + dstPos; final int bits = (src[i + srcPos] ? 1 : 0) << shift; final int mask = 0x1 << shift; - out = (byte)((out & ~mask) | bits); + out = (byte) ((out & ~mask) | bits); } return out; } @@ -1081,18 +1068,18 @@ public class Conversion { * @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; } if ((nInts - 1) * 32 + srcPos >= 64) { - throw new IllegalArgumentException( - "(nInts-1)*32+srcPos is greather or equal to than 64"); + throw new IllegalArgumentException("(nInts-1)*32+srcPos is greather or equal to than 64"); } int shift = 0; - for (int i = 0; i < nInts; i++ ) { + for (int i = 0; i < nInts; i++) { shift = i * 32 + srcPos; - dst[dstPos + i] = (int)(0xffffffff & (src >> shift)); + dst[dstPos + i] = (int) (0xffffffff & (src >> shift)); } return dst; } @@ -1115,18 +1102,17 @@ public class Conversion { * @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) { + final int nShorts) { if (0 == nShorts) { return dst; } if ((nShorts - 1) * 16 + srcPos >= 64) { - throw new IllegalArgumentException( - "(nShorts-1)*16+srcPos is greather or equal to than 64"); + throw new IllegalArgumentException("(nShorts-1)*16+srcPos is greather or equal to than 64"); } int shift = 0; - for (int i = 0; i < nShorts; i++ ) { + for (int i = 0; i < nShorts; i++) { shift = i * 16 + srcPos; - dst[dstPos + i] = (short)(0xffff & (src >> shift)); + dst[dstPos + i] = (short) (0xffff & (src >> shift)); } return dst; } @@ -1149,18 +1135,17 @@ public class Conversion { * @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) { + final int nShorts) { if (0 == nShorts) { return dst; } if ((nShorts - 1) * 16 + srcPos >= 32) { - throw new IllegalArgumentException( - "(nShorts-1)*16+srcPos is greather or equal to than 32"); + throw new IllegalArgumentException("(nShorts-1)*16+srcPos is greather or equal to than 32"); } int shift = 0; - for (int i = 0; i < nShorts; i++ ) { + for (int i = 0; i < nShorts; i++) { shift = i * 16 + srcPos; - dst[dstPos + i] = (short)(0xffff & (src >> shift)); + dst[dstPos + i] = (short) (0xffff & (src >> shift)); } return dst; } @@ -1183,18 +1168,17 @@ public class Conversion { * @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) { + final int nBytes) { if (0 == nBytes) { return dst; } if ((nBytes - 1) * 8 + srcPos >= 64) { - throw new IllegalArgumentException( - "(nBytes-1)*8+srcPos is greather or equal to than 64"); + throw new IllegalArgumentException("(nBytes-1)*8+srcPos is greather or equal to than 64"); } int shift = 0; - for (int i = 0; i < nBytes; i++ ) { + for (int i = 0; i < nBytes; i++) { shift = i * 8 + srcPos; - dst[dstPos + i] = (byte)(0xff & (src >> shift)); + dst[dstPos + i] = (byte) (0xff & (src >> shift)); } return dst; } @@ -1216,18 +1200,18 @@ public class Conversion { * @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; } if ((nBytes - 1) * 8 + srcPos >= 32) { - throw new IllegalArgumentException( - "(nBytes-1)*8+srcPos is greather or equal to than 32"); + throw new IllegalArgumentException("(nBytes-1)*8+srcPos is greather or equal to than 32"); } int shift = 0; - for (int i = 0; i < nBytes; i++ ) { + for (int i = 0; i < nBytes; i++) { shift = i * 8 + srcPos; - dst[dstPos + i] = (byte)(0xff & (src >> shift)); + dst[dstPos + i] = (byte) (0xff & (src >> shift)); } return dst; } @@ -1250,18 +1234,17 @@ public class Conversion { * @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) { + final int nBytes) { if (0 == nBytes) { return dst; } if ((nBytes - 1) * 8 + srcPos >= 16) { - throw new IllegalArgumentException( - "(nBytes-1)*8+srcPos is greather or equal to than 16"); + throw new IllegalArgumentException("(nBytes-1)*8+srcPos is greather or equal to than 16"); } int shift = 0; - for (int i = 0; i < nBytes; i++ ) { + for (int i = 0; i < nBytes; i++) { shift = i * 8 + srcPos; - dst[dstPos + i] = (byte)(0xff & (src >> shift)); + dst[dstPos + i] = (byte) (0xff & (src >> shift)); } return dst; } @@ -1282,20 +1265,20 @@ public class Conversion { * @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; } if ((nHexs - 1) * 4 + srcPos >= 64) { - throw new IllegalArgumentException( - "(nHexs-1)*4+srcPos is greather or equal to than 64"); + throw new IllegalArgumentException("(nHexs-1)*4+srcPos is greather or equal to than 64"); } final StringBuilder sb = new StringBuilder(dstInit); int shift = 0; int append = sb.length(); - for (int i = 0; i < nHexs; i++ ) { + for (int i = 0; i < nHexs; i++) { shift = i * 4 + srcPos; - final int bits = (int)(0xF & (src >> shift)); + final int bits = (int) (0xF & (src >> shift)); if (dstPos + i == append) { ++append; sb.append(intToHexDigit(bits)); @@ -1322,18 +1305,18 @@ public class Conversion { * @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; } if ((nHexs - 1) * 4 + srcPos >= 32) { - throw new IllegalArgumentException( - "(nHexs-1)*4+srcPos is greather or equal to than 32"); + throw new IllegalArgumentException("(nHexs-1)*4+srcPos is greather or equal to than 32"); } final StringBuilder sb = new StringBuilder(dstInit); int shift = 0; int append = sb.length(); - for (int i = 0; i < nHexs; i++ ) { + for (int i = 0; i < nHexs; i++) { shift = i * 4 + srcPos; final int bits = 0xF & (src >> shift); if (dstPos + i == append) { @@ -1362,18 +1345,18 @@ public class Conversion { * @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; } if ((nHexs - 1) * 4 + srcPos >= 16) { - throw new IllegalArgumentException( - "(nHexs-1)*4+srcPos is greather or equal to than 16"); + throw new IllegalArgumentException("(nHexs-1)*4+srcPos is greather or equal to than 16"); } final StringBuilder sb = new StringBuilder(dstInit); int shift = 0; int append = sb.length(); - for (int i = 0; i < nHexs; i++ ) { + for (int i = 0; i < nHexs; i++) { shift = i * 4 + srcPos; final int bits = 0xF & (src >> shift); if (dstPos + i == append) { @@ -1402,18 +1385,18 @@ public class Conversion { * @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; } if ((nHexs - 1) * 4 + srcPos >= 8) { - throw new IllegalArgumentException( - "(nHexs-1)*4+srcPos is greather or equal to than 8"); + throw new IllegalArgumentException("(nHexs-1)*4+srcPos is greather or equal to than 8"); } final StringBuilder sb = new StringBuilder(dstInit); int shift = 0; int append = sb.length(); - for (int i = 0; i < nHexs; i++ ) { + for (int i = 0; i < nHexs; i++) { shift = i * 4 + srcPos; final int bits = 0xF & (src >> shift); if (dstPos + i == append) { @@ -1444,16 +1427,15 @@ public class Conversion { * @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) { + final int nBools) { if (0 == nBools) { return dst; } if (nBools - 1 + srcPos >= 64) { - throw new IllegalArgumentException( - "nBools-1+srcPos is greather or equal to than 64"); + throw new IllegalArgumentException("nBools-1+srcPos is greather or equal to than 64"); } int shift = 0; - for (int i = 0; i < nBools; i++ ) { + for (int i = 0; i < nBools; i++) { shift = i + srcPos; dst[dstPos + i] = ((0x1 & (src >> shift)) != 0); } @@ -1478,16 +1460,15 @@ public class Conversion { * @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) { + final int nBools) { if (0 == nBools) { return dst; } if (nBools - 1 + srcPos >= 32) { - throw new IllegalArgumentException( - "nBools-1+srcPos is greather or equal to than 32"); + throw new IllegalArgumentException("nBools-1+srcPos is greather or equal to than 32"); } int shift = 0; - for (int i = 0; i < nBools; i++ ) { + for (int i = 0; i < nBools; i++) { shift = i + srcPos; dst[dstPos + i] = ((0x1 & (src >> shift)) != 0); } @@ -1512,17 +1493,16 @@ public class Conversion { * @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) { + final int nBools) { if (0 == nBools) { return dst; } if (nBools - 1 + srcPos >= 16) { - throw new IllegalArgumentException( - "nBools-1+srcPos is greather or equal to than 16"); + throw new IllegalArgumentException("nBools-1+srcPos is greather or equal to than 16"); } int shift = 0; assert ((nBools - 1) < 16 - srcPos); - for (int i = 0; i < nBools; i++ ) { + for (int i = 0; i < nBools; i++) { shift = i + srcPos; dst[dstPos + i] = ((0x1 & (src >> shift)) != 0); } @@ -1547,7 +1527,7 @@ public class Conversion { * @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) { + final int nBools) { if (0 == nBools) { return dst; } @@ -1555,7 +1535,7 @@ public class Conversion { throw new IllegalArgumentException("nBools-1+srcPos is greather or equal to than 8"); } int shift = 0; - for (int i = 0; i < nBools; i++ ) { + for (int i = 0; i < nBools; i++) { shift = i + srcPos; dst[dstPos + i] = ((0x1 & (src >> shift)) != 0); } @@ -1609,7 +1589,6 @@ public class Conversion { if (src.length - srcPos < 16) { throw new IllegalArgumentException("Need at least 16 bytes for UUID"); } - return new UUID(byteArrayToLong(src, srcPos, 0, 0, 8), byteArrayToLong( - src, srcPos + 8, 0, 0, 8)); + return new UUID(byteArrayToLong(src, srcPos, 0, 0, 8), byteArrayToLong(src, srcPos + 8, 0, 0, 8)); } }