reset(): This method is available in java.nio.LongBuffer class of Java.
Syntax:
LongBuffer java.nio.LongBuffer.reset()
This method resets this buffer's position to the previously-marked position.
Parameters: NA
Returns: This buffer.
Exceptions: NA
Approach
Java
import java.nio.LongBuffer;public class LongBufferreset {public static void main(String[] args) {long array[] = { 1, 2, 3, 4, 6 };LongBuffer lb = LongBuffer.wrap(array);lb.position(3);lb.mark();lb.position(5);System.out.println("position before reset: " +lb.position());lb.reset();System.out.println("position after reset: " +lb.position());}}
Output:
position before reset: 5
position after reset: 3
No comments:
Post a Comment