Here you can find the source of grow(ByteBuffer buffer, int minCapacityIncrease)
private static ByteBuffer grow(ByteBuffer buffer, int minCapacityIncrease)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { private static ByteBuffer grow(ByteBuffer buffer, int minCapacityIncrease) { ByteBuffer tmp = ByteBuffer .allocate(Math.max(buffer.capacity() << 1, buffer.capacity() + minCapacityIncrease)); buffer.flip();/* w w w .j a va2s. c o m*/ tmp.put(buffer); return tmp; } }