diff options
Diffstat (limited to 'src/main/java/com/google/android/mobly/snippet/bundled/utils/Utils.java')
-rw-r--r-- | src/main/java/com/google/android/mobly/snippet/bundled/utils/Utils.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/com/google/android/mobly/snippet/bundled/utils/Utils.java b/src/main/java/com/google/android/mobly/snippet/bundled/utils/Utils.java index 376bcb5..e4c0dbd 100644 --- a/src/main/java/com/google/android/mobly/snippet/bundled/utils/Utils.java +++ b/src/main/java/com/google/android/mobly/snippet/bundled/utils/Utils.java @@ -30,7 +30,7 @@ import java.util.concurrent.TimeoutException; public final class Utils { - private static final char[] hexArray = "0123456789abcdef".toCharArray(); + private final static char[] hexArray = "0123456789abcdef".toCharArray(); private Utils() {} @@ -194,20 +194,22 @@ public final class Utils { } /** - * Convert a byte array (binary data) to a hexadecimal string (ASCII) representation. - * - * <p>[\x01\x02] -> "0102" + * Convert a byte array (binary data) to a hexadecimal string (ASCII) + * representation. + + * [\x01\x02] -> "0102" * * @param bytes The array of byte to convert. * @return a String with the ASCII hex representation. */ public static String bytesToHexString(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; - for (int j = 0; j < bytes.length; j++) { + for ( int j = 0; j < bytes.length; j++ ) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars); } + } |