code: public static byte[] longToByteArray(final long src, final int srcPos, final byte[] dst, final int dstPos,
              final int nBytes) {
          if (0 == nBytes) {
              return dst;
          }
          if ((nBytes - 1) * 8 + srcPos >= 64) {
              throw new IllegalArgumentException("(nBytes-1)*8+srcPos is greater or equal to than 64");
          }
          for (int i = 0; i < nBytes; i++) {
              final int shift = i * 8 + srcPos;
              dst[dstPos + i] = (byte) (0xff & (src >> shift));
          }
          return dst;
      }
docs: <p>
  Converts a long into an array of byte using the default (little endian, Lsb0) byte and
  bit ordering.
  </p>
  
  @param src the long to convert
  @param srcPos the position in {@code src}, in bits, from where to start the conversion
  @param dst the destination array
  @param dstPos the position in {@code dst} where to copy the result
  @param nBytes the number of bytes to copy to {@code dst}, must be smaller or equal to the
  width of the input (from srcPos to msb)
  @return {@code dst}
  @throws NullPointerException if {@code dst} is {@code null}
  @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 64}
  @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}