cleanup: use for-each loop where applicable

This commit is contained in:
P0nk
2021-04-08 07:36:38 +02:00
parent 0ff8a80ef2
commit 5c6f515d18
16 changed files with 103 additions and 105 deletions

View File

@@ -22,6 +22,7 @@
package tools;
import constants.string.CharsetConstants;
import java.io.ByteArrayOutputStream;
public class HexTool {
@@ -35,8 +36,8 @@ public class HexTool {
public static String toString(byte[] bytes) {
StringBuilder hexed = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
hexed.append(toString(bytes[i]));
for (byte aByte : bytes) {
hexed.append(toString(aByte));
hexed.append(' ');
}
return hexed.substring(0, hexed.length() - 1);
@@ -44,8 +45,8 @@ public class HexTool {
public static String toCompressedString(byte[] bytes) {
StringBuilder hexed = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
hexed.append(toString(bytes[i]));
for (byte aByte : bytes) {
hexed.append(toString(aByte));
}
return hexed.substring(0, hexed.length());
}