Java ByteOrder get system default byte order

Description

Java ByteOrder get system default byte order

import java.nio.ByteOrder;

public class Main {
  public static void main(String args[]) {
    ByteOrder b = ByteOrder.nativeOrder();
    if (b.equals(ByteOrder.BIG_ENDIAN)) {
      System.out.println("Big endian");
    } else {//  ww  w .j ava2 s  . c  o  m
      System.out.println("Little endian");
    }
  }
}



PreviousNext

Related