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.
Syntax:
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); bb.put((short)44); // using the order method System.out.println(bb.order()); } } |
LITTLE_ENDIAN
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- ShortBuffer allocate() method in Java With Examples
- ShortBuffer compact() method in Java With Examples
- ShortBuffer arrayOffset() method in Java With Examples
- ShortBuffer asReadOnlyBuffer() method in Java with Examples
- ShortBuffer isDirect() Method in Java with Examples
- ShortBuffer hashCode() Method in Java with Examples
- ShortBuffer put(int, short) method in Java With Examples
- ShortBuffer toString() method in Java with Examples
- ShortBuffer array() Method in Java with Examples
- ShortBuffer compareTo method in Java with Examples
- ShortBuffer duplicate() method in Java With Examples
- ShortBuffer limit() method in Java with Examples
- ShortBuffer hasArray() method in Java with Examples
- ShortBuffer reset() method in Java with Examples
- ShortBuffer equals() method in Java with Examples
- ShortBuffer rewind() method in Java with Examples
- ShortBuffer slice() method in Java with Examples
- ShortBuffer mark() method in Java with Examples
- ShortBuffer flip() methods in Java with Examples
- ShortBuffer clear() methods in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

