Here you can find the source of setLittleIndianInBytesArray(byte[] toPutIn, int startidx, long theNumber, int len)
Parameter | Description |
---|---|
toPutIn | - the array to put in |
startidx | - start index of the num |
theNumber | - the number |
len | - the number size in bytes. |
public static void setLittleIndianInBytesArray(byte[] toPutIn, int startidx, long theNumber, int len)
//package com.java2s; public class Main { /**// w ww .j av a 2 s . c o m * put number in array (big endian way) * @param toPutIn - the array to put in * @param startidx - start index of the num * @param theNumber - the number * @param len - the number size in bytes. */ public static void setLittleIndianInBytesArray(byte[] toPutIn, int startidx, long theNumber, int len) { for (int i = 0; i < len; i++) { toPutIn[i + startidx] = (byte) (theNumber % 256); theNumber /= 256; } } }