code: public static void setBytesFromInt(byte[] bytes,
                                         int    offset,
                                         int    byteCount,
                                         int    value)
      {
          long maxval = ((1L << (8 * byteCount)) - 1);
          if (value > maxval)
          {
              final String msg = "value too large for byteCount";
              IllegalArgumentException iae = new IllegalArgumentException(msg);
              FFDCFilter.processException(
                  iae,
                  "com.ibm.ws.Transaction.JTA.Util.setBytesFromInt",
                  "579");
              throw iae;
          }
  
          switch (byteCount)
          {
              case 4: bytes[offset++] = (byte) ((value >> 24) & 0xFF);
              case 3: bytes[offset++] = (byte) ((value >> 16) & 0xFF);
              case 2: bytes[offset++] = (byte) ((value >> 8 ) & 0xFF);
              case 1: bytes[offset++] = (byte) ((value      ) & 0xFF);
                  break;
              default:
                  final String msg = "byteCount is not between 1 and 4";
                  IllegalArgumentException iae =
                      new IllegalArgumentException(msg);
                  FFDCFilter.processException(
                      iae,
                      "com.ibm.ws.Transaction.JTA.Util.setBytesFromInt",
                      "598");
                  throw iae;
          }
      }
docs: Utility function to set sequence numbers in big-endian format
  in a byte array.