Java Number to Byte numberToByte(long l, int length)

Here you can find the source of numberToByte(long l, int length)

Description

number To Byte

License

Open Source License

Declaration

private static byte[] numberToByte(long l, int length) 

Method Source Code

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

public class Main {

    private static byte[] numberToByte(long l, int length) {
        byte[] bts = new byte[length];
        for (int i = 0; i < length; i++) {
            bts[i] = (byte) (l >> ((length - i - 1) * 8));
        }//from   w w w.j a  v  a  2 s. c o  m
        return bts;
    }
}

Related

  1. NumberToByte(final Number value)
  2. numberToByte(Object obj)