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