to Little Endian Dword - Java Internationalization

Java examples for Internationalization:Charset

Description

to Little Endian Dword

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(toLittleEndianDword(value)));
    }/*from www  .  ja va 2  s .  c o  m*/

    public static byte[] toLittleEndianDword(final long value) {
        return new byte[] { (byte) (value & 0x000000FFL),
                (byte) ((value & 0x0000FF00L) >>> 8),
                (byte) ((value & 0x00FF0000L) >>> 16),
                (byte) ((value & 0xFF000000L) >>> 24) };
    }
}

Related Tutorials