Buffer.remaining() has the following syntax.
public final int remaining()
In the following code shows how to use Buffer.remaining() method.
import java.nio.ByteBuffer; public class Main { public static void main(String[] argv) throws Exception { ByteBuffer buf = ByteBuffer.allocateDirect(10); int rem = buf.remaining(); System.out.println(rem); } }
The code above generates the following result.