public IntBuffer compact() { if (position() > 0) { int count = limit() - position(); bb.shiftDown(offset, offset + 4 * position(), 4 * count); position(count); limit(capacity()); } else { position(limit()); limit(capacity()); } return this; }