Could this be simplified a lot with Arrays.hashCode()?