Java Integer Convert To integerToLittleEndian(byte[] buf, int offset, long value, int numBytes)

Here you can find the source of integerToLittleEndian(byte[] buf, int offset, long value, int numBytes)

Description

Converts a integral value to the corresponding little endian array.

License

Open Source License

Declaration

private static byte[] integerToLittleEndian(byte[] buf, int offset, long value, int numBytes) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

public class Main {
    /** Converts a integral value to the corresponding little endian array. */
    private static byte[] integerToLittleEndian(byte[] buf, int offset, long value, int numBytes) {
        for (int i = 0; i < numBytes; i++) {
            buf[i + offset] = (byte) ((value & (0xffL << (i * 8))) >> (i * 8));
        }//w  w w  .  j a va 2 s .  co m
        return buf;
    }
}

Related

  1. integerToASCII(int number)
  2. integerToByte(int i)
  3. IntegerTochar(final Integer value)
  4. integerToFloat(float f, int i, float offset, boolean rotate)
  5. IntegerToInt(Integer[] in)
  6. integerToTimeString(Integer num)