LongBuffer flip() in Java

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

Syntax:

LongBuffer java.nio.LongBuffer.flip()

This method flips this buffer. The limit is set to the current position and then the position is set to zero. If the mark is defined then it is discarded.

Parameters: NA

Returns: This buffer.

Exceptions: NA

Approach

Java

import java.nio.LongBuffer;

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

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

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

Output:

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


No comments:

Post a Comment