public int next() {
            if (size == 0)
                return 0;
            int next = current + step;
            if (next < 0 || next > size)
                step = 0 - step;
            current = current + step;
            return current;
        }