Skip to content

Commit 307e56c

Browse files
committed
close #3
1 parent 2c09d79 commit 307e56c

File tree

1 file changed

+11
-28
lines changed

1 file changed

+11
-28
lines changed

src/main/java/de/rub/nds/modifiablevariable/util/ArrayConverter.java

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,8 @@ public static byte[] longToUint32Bytes(long l) {
5555
/**
5656
* Takes an integer value and stores its last bytes into a byte array
5757
*
58-
* @param value
59-
* integer value
60-
* @param size
61-
* byte size of the new integer byte array
58+
* @param value integer value
59+
* @param size byte size of the new integer byte array
6260
* @return
6361
*/
6462
public static byte[] intToBytes(int value, int size) {
@@ -78,10 +76,8 @@ public static byte[] intToBytes(int value, int size) {
7876
/**
7977
* Takes a long value and stores its last bytes into a byte array
8078
*
81-
* @param value
82-
* long value
83-
* @param size
84-
* byte size of the new integer byte array
79+
* @param value long value
80+
* @param size byte size of the new integer byte array
8581
* @return
8682
*/
8783
public static byte[] longToBytes(long value, int size) {
@@ -134,35 +130,23 @@ public static String bytesToHexString(byte[] array) {
134130
if (array == null) {
135131
array = new byte[0];
136132
}
137-
return bytesToHexString(array, array.length);
138-
}
139-
140-
public static String bytesToHexString(byte[] array, int byteSize) {
141-
boolean usePrettyPrinting = (byteSize > 15);
142-
return bytesToHexString(array, byteSize, usePrettyPrinting);
133+
boolean usePrettyPrinting = (array.length > 15);
134+
return bytesToHexString(array, usePrettyPrinting);
143135
}
144136

145137
public static String bytesToHexString(byte[] array, boolean usePrettyPrinting) {
146138
if (array == null) {
147139
array = new byte[0];
148140
}
149-
return bytesToHexString(array, array.length, usePrettyPrinting);
150-
}
151-
152-
public static String bytesToHexString(byte[] array, int byteSize, boolean usePrettyPrinting) {
153-
if (array == null) {
154-
array = new byte[0];
155-
}
156-
return bytesToHexString(array, array.length, usePrettyPrinting, true);
141+
return bytesToHexString(array, usePrettyPrinting, true);
157142
}
158143

159-
public static String bytesToHexString(byte[] array, int byteSize, boolean usePrettyPrinting, boolean initialNewLine) {
144+
public static String bytesToHexString(byte[] array, boolean usePrettyPrinting, boolean initialNewLine) {
160145
StringBuilder result = new StringBuilder();
161-
int bs = (byteSize < array.length) ? byteSize : array.length;
162146
if (initialNewLine && usePrettyPrinting) {
163147
result.append("\n");
164148
}
165-
for (int i = 0; i < bs; i++) {
149+
for (int i = 0; i < array.length; i++) {
166150
if (usePrettyPrinting && i != 0) {
167151
if (i % 16 == 0) {
168152
result.append("\n");
@@ -241,9 +225,8 @@ public static void makeArrayNonZero(final byte[] array) {
241225
*
242226
* @param value
243227
* @param blockSize
244-
* @param removeSignByte
245-
* in a case the removeSignByte is set, the sign byte is removed
246-
* (in case the byte array contains one)
228+
* @param removeSignByte in a case the removeSignByte is set, the sign byte
229+
* is removed (in case the byte array contains one)
247230
* @return
248231
*/
249232
public static byte[] bigIntegerToByteArray(BigInteger value, int blockSize, boolean removeSignByte) {

0 commit comments

Comments
 (0)