IteratorSimpleNumber implements Iterator { @Override public boolean hasNext() { int currentPosition = this.position; boolean result = false; do { int valueArray = this.value[currentPosition++]; if (checkNumber(valueArray)) { result = true; break; } } while(currentPosition < this.value.length); return result; } IteratorSimpleNumber(int[] value); @Override boolean hasNext(); @Override Object next(); @Override void remove();  }
@Test public void hasNext() throws Exception { IteratorSimpleNumber it = new IteratorSimpleNumber(new int[]{1,2,3,4,5,11,67}); it.next(); it.next(); boolean result = it.hasNext(); Assert.assertThat(result,is(true)); }