reset(): This method is available in java.nio.IntBuffer class of Java.
Syntax:
IntBuffer java.nio.IntBuffer.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.IntBuffer;public class IntBufferreset {public static void main(String[] args) {int array[] = { 1, 2, 3, 4, 6 };IntBuffer lb = IntBuffer.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