Java.util usage

Are we allowed to use packages from Java.util? I would like to use Arrays.equals(), but for that Java.util.Arrays package is required.

If that is not allowed, then is there any other possible way of comparing byte arrays?

One could always compare it manually using a for loop.
But yes, java.util classes are allowed and Arrays.equals is the correct choice here.

Note:
For byte arrays Arrays.equals is enough.
But some arrays structures like two-dimensional arrays might need Arrays.deepEquals.
The reason is that Arrays.equals goes through the array and compares each component using the equals method of the inner type.

1 Like