IntBuffer remaining() in Java

remaining(): This method is available in java.nio.Buffer class of Java.

Syntax:

int java.nio.Buffer.remaining()

This method returns the number of elements between the current position and the limit.

Parameters: NA

Returns: The number of elements remaining in this buffer.

Exceptions: NA

Approach

Java

import java.nio.IntBuffer;

public class IntBufferremaining {
    public static void main(String[] args) {

        int array[] = { 1, 2, 3, 4 };
        IntBuffer lb = IntBuffer.wrap(array);

        System.out.println(lb.remaining());
    }
}

Output:

4


No comments:

Post a Comment