code: public static void numberToBytes(int number, byte[] buffer, int start, int length) {
          for (int index = start + length - 1; index >= start; index--) {
              buffer[index] = (byte)(number & 0xff);
              number = number >> 8;
          }
      }
docs: Writes a number to the specified byte array field, breaking it into its component bytes in big-endian order.
  If the number is too large to fit in the specified number of bytes, only the low-order bytes are written.
  
  @param number the number to be written to the array
  @param buffer the buffer to which the number should be written
  @param start where the high-order byte should be written
  @param length how many bytes of the number should be written