to Little Endian Word - Java Internationalization

Java examples for Internationalization:Charset

Description

to Little Endian Word

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        long value = 2;
        System.out.println(java.util.Arrays
                .toString(toLittleEndianWord(value)));
    }/*  w w w .  j a va 2s. com*/

    public static byte[] toLittleEndianWord(final long value) {
        return new byte[] { (byte) (value & 0xFF),
                (byte) ((value & 0xFF00L) >>> 8) };
    }
}

Related Tutorials