private void nextBytesInternal(byte[] out, int offset, int length) {

            if (length == 0)
                return;

            if (offset < 0 || length < 0 || offset + length > out.length)
                throw new ArrayIndexOutOfBoundsException("offset=" + offset + " length="
                        + length + " limit="
                        + out.length);
            if (ndx >= buffer.length) {
                fillBlock();
                ndx = 0;
            }
            int count = 0;
            while (count < length) {
                int amount = Math.min(buffer.length - ndx, length - count);
                System.arraycopy(buffer, ndx, out, offset + count, amount);
                count += amount;
                ndx += amount;
                if (ndx >= buffer.length) {
                    fillBlock();
                    ndx = 0;
                }
            }
        }