ValidAnagram { public static boolean isAnagram(String s, String t) { int[] sc1 = new int[256]; int[] sc2 = new int[256]; for (char c : s.toCharArray()) { sc1[c]++; } for (char c : t.toCharArray()) { sc2[c]++; } return Arrays.equals(sc1, sc2); }  static boolean isAnagram(String s, String t);  }
@Test(dataProvider = "anagramString") public void testIsAnagram(String s1, String s2, boolean expected) { assertEquals(ValidAnagram.isAnagram(s1, s2), expected); }