Compares the two arrays. @param array1 the first byte array. @param array2 the second byte array. @return true if both arrays are null or if the arrays have the same length and the elements at each index in the two arrays are equ
(byte[] array1, byte[] array2)
| 1160 | * equal, {@code false} otherwise. |
| 1161 | */ |
| 1162 | public static boolean equals(byte[] array1, byte[] array2) { |
| 1163 | if (array1 == array2) { |
| 1164 | return true; |
| 1165 | } |
| 1166 | if (array1 == null || array2 == null || array1.length != array2.length) { |
| 1167 | return false; |
| 1168 | } |
| 1169 | for (int i = 0; i < array1.length; i++) { |
| 1170 | if (array1[i] != array2[i]) { |
| 1171 | return false; |
| 1172 | } |
| 1173 | } |
| 1174 | return true; |
| 1175 | } |
| 1176 | |
| 1177 | /** |
| 1178 | * Compares the two arrays. |
no test coverage detected