Java Long Number Convert To fromLong(long value, int numBytes)

Here you can find the source of fromLong(long value, int numBytes)

Description

from Long

License

Open Source License

Declaration

public static byte[] fromLong(long value, int numBytes) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static byte[] fromLong(long value, int numBytes) {
        long mask = 0xFF;
        byte[] res = new byte[numBytes];
        for (int i = 0; i < numBytes; i++) {
            res[i] = (byte) (value & mask);
            value = value >> 8;//from  w  w w . j ava2  s. c  o m
        }
        return res;
    }
}

Related

  1. fromLong(long key)
  2. fromLong(long longValue)
  3. fromLong(long v, int offset, byte[] dest)
  4. fromLong(Long value)
  5. fromLong(long value)
  6. fromLong(long x)
  7. fromLongString(String longString)