LongBuffer 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.LongBuffer;

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

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

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

Output:

4


No comments:

Post a Comment