Some other options if you do not want your own "Utils"-class:
Use Apache commons lang (ArrayUtils):
@Test
public void arrayCommonLang(){
char[] test = {'h', 'e', 'l', 'l', 'o'};
Assert.assertTrue(ArrayUtils.contains(test, 'o'));
Assert.assertFalse(ArrayUtils.contains(test, 'p'));
}
Or use the builtin Arrays:
@Test
public void arrayTest(){
char[] test = {'h', 'e', 'l', 'l', 'o'};
Assert.assertTrue(Arrays.binarySearch(test, 'o') >= 0);
Assert.assertTrue(Arrays.binarySearch(test, 'p') < 0);
}
Or use the Chars class from Google Guava:
@Test
public void testGuava(){
char[] test = {'h', 'e', 'l', 'l', 'o'};
Assert.assertTrue(Chars.contains(test, 'o'));
Assert.assertFalse(Chars.contains(test, 'p'));
}
Slightly off-topic, the Chars class allows to find a subarray in an array.