code: public static void writeBytes(byte[] bytes, long value, int offset, int numBytes) {
          int shift = 0;
          for(int i = offset + numBytes - 1; i >= offset; i--) {
              bytes[i] = (byte) (0xFF & (value >> shift));
              shift += 8;
          }
      }
docs: Write the given number of bytes out to the array
  
  @param bytes The array to write to
  @param value The value to write from
  @param offset the offset into the array
  @param numBytes The number of bytes to write