Open In App
Related Articles

ShortBuffer order() Method in Java with Examples

Improve Article
Save Article
Like Article

The order() method of java.nio.ShortBuffer is used to retrieve the buffer’s byte order.
The byte order of a short buffer created by allocation or by wrapping an existing short array is the native order of the underlying hardware. The byte order of a short buffer created as a view of a byte buffer is that of the byte buffer at the moment that the view is created.


public abstract ByteOrder order()

Return Value: The method returns the buffer’s byte order.

Below programs illustrate the use of order() method:

Program 1:

// Java program to demonstrate
// order() method
import java.nio.*;
import java.util.*;
public class GFG {
    public static void main(String[] args)
        // creating short buffer
        ShortBuffer bb = ShortBuffer.allocate(7);
        // using the order method


Last Updated : 20 Sep, 2018
Like Article
Save Article
Similar Reads
Related Tutorials