LongBuffer limit() in Java

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

Syntax:

int java.nio.Buffer.limit()

This method returns this buffer's limit.

Parameters: NA

Returns: The limit of this buffer.

Exceptions: NA

Approach

Java

import java.nio.LongBuffer;

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

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

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

Output:

4


limit(int)


No comments:

Post a Comment