LongBuffer toString() in Java

toString(): This method is available in java.nio.LongBuffer class of Java.

Syntax:

String java.nio.LongBuffer.toString()

This method returns a string summarizing the state of this buffer.

Parameters: NA

Returns: A summary string.

Exceptions: NA

Approach

Java

import java.nio.LongBuffer;

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

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

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

Output:

java.nio.HeapLongBuffer[pos=0 lim=4 cap=4]


No comments:

Post a Comment