最大公约数

@param m 第一个值
@param n 第二个值
@return 最大公约数
420440
public static int divisor(int m, int n) {
		while (m % n != 0) {
			int temp = m % n;
			m = n;
			n = temp;
		}
		return n;
	}
713632
public function encrypt($m, $e, $n, $s = 3)
    {
        $coded = '';
        $max = strlen($m);
        $packets = ceil($max / $s);
        for ($i = 0; $i < $packets; $i++) {
            $packet = substr($m, $i * $s, $s);
            $code = '0';
            for ($j = 0; $j < $s; $j++) {
                $code = bcadd($code, bcmul(ord($packet[$j]), bcpow('256', $j)));
            }
            $code = bcpowmod($code, $e, $n);
            $coded .= $code . ' ';
        }

        return trim($coded);
    }
1346474
public static String stringFor(int n)
    {
        if (n == 0)
        {
            return "INVALID CUipcMem_flags: "+n;
        }
        String result = "";
        if ((n & CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS) != 0) result += "CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS";
        return result;
    }
879647
private static PublicKey getPublicKey(String modulus, String exponent) {
		try {
			BigInteger b1 = new BigInteger(modulus);
			BigInteger b2 = new BigInteger(exponent);
			KeyFactory keyFactory = KeyFactory.getInstance("RSA", "BC");
			RSAPublicKeySpec keySpec = new RSAPublicKeySpec(b1, b2);
			return keyFactory.generatePublic(keySpec);
		} catch (Exception e) {
			LogUtil.writeErrorLog("构造RSA公钥失败：" + e);
			return null;
		}
	}
1180748
public final long nextLong(final long n)
        {
        if (n<=0)
            throw new IllegalArgumentException("n must be > 0");
        
        long bits, val;
        do 
            {
            int y;
            int z;
    
            if (mti >= N)   // generate N words at one time
                {
                int kk;
                @SuppressWarnings("hiding")
				final int[] mt = this.mt; // locals are slightly faster 
                @SuppressWarnings("hiding")
				final int[] mag01 = this.mag01; // locals are slightly faster 
            
                for (kk = 0; kk < N - M; kk++)
                    {
                    y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
                    mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
                    }
                for (; kk < N-1; kk++)
                    {
                    y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
                    mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
                    }
                y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
                mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
    
                mti = 0;
                }
    
            y = mt[mti++];
            y ^= y >>> 11;                          // TEMPERING_SHIFT_U(y)
            y ^= (y << 7) & TEMPERING_MASK_B;       // TEMPERING_SHIFT_S(y)
            y ^= (y << 15) & TEMPERING_MASK_C;      // TEMPERING_SHIFT_T(y)
            y ^= (y >>> 18);                        // TEMPERING_SHIFT_L(y)
    
            if (mti >= N)   // generate N words at one time
                {
                int kk;
                @SuppressWarnings("hiding")
				final int[] mt = this.mt; // locals are slightly faster 
                @SuppressWarnings("hiding")
				final int[] mag01 = this.mag01; // locals are slightly faster 
                
                for (kk = 0; kk < N - M; kk++)
                    {
                    z = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
                    mt[kk] = mt[kk+M] ^ (z >>> 1) ^ mag01[z & 0x1];
                    }
                for (; kk < N-1; kk++)
                    {
                    z = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
                    mt[kk] = mt[kk+(M-N)] ^ (z >>> 1) ^ mag01[z & 0x1];
                    }
                z = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
                mt[N-1] = mt[M-1] ^ (z >>> 1) ^ mag01[z & 0x1];
                
                mti = 0;
                }
            
            z = mt[mti++];
            z ^= z >>> 11;                          // TEMPERING_SHIFT_U(z)
            z ^= (z << 7) & TEMPERING_MASK_B;       // TEMPERING_SHIFT_S(z)
            z ^= (z << 15) & TEMPERING_MASK_C;      // TEMPERING_SHIFT_T(z)
            z ^= (z >>> 18);                        // TEMPERING_SHIFT_L(z)
            
            bits = (((((long)y) << 32) + z) >>> 1);
            val = bits % n;
            } while (bits - val + (n-1) < 0);
        return val;
        }
314783
public static String convert( long x, int n, String d ) {
        if (x == 0) {
            return "0";
        }

        String r = "";
        int m = 1 << n;
        m--;
        while( x != 0 ) {
            r = d.charAt((int) (x & m)) + r;
            x = x >>> n;
        }
        return r;
    }
1048314
static String getMethodSignature(Method m) {
      StringBuilder result = new StringBuilder();
      result.append('(');
      for (Class<?> parameterType : m.getParameterTypes()) {
        result.append(getSignature(parameterType));
      }
      result.append(")");
      result.append(getSignature(m.getReturnType()));
      return result.toString();
    }
942096
public void write4BE(final long n) {
        write((byte) ((n & 0xff000000) >> 24));
        write((byte) ((n & 0xff0000) >> 16));
        write((byte) ((n & 0xff00) >> 8));
        write((byte) (n & 0xff));
    }
168980
public Rational Pochhammer(final BigInteger n) {
        if (n.compareTo(BigInteger.ZERO) < 0) {
            return null;
        } else if (n.compareTo(BigInteger.ZERO) == 0) {
            return Rational.ONE;
        } else {
            /* initialize results with the current value
             */
            Rational res = new Rational(a, b);
            BigInteger i = BigInteger.ONE;
            for (; i.compareTo(n) < 0; i = i.add(BigInteger.ONE)) {
                res = res.multiply(add(i));
            }
            return res;
        }
    }
1219489
public static int nChooseK(int n, int k) {
    k = Math.min(k, n - k);
    if (k == 0) {
      return 1;
    }
    int accum = n;
    for (int i = 1; i < k; i++) {
      accum *= (n - i);
      accum /= i;
    }
    return accum / k;
  }
371053
public static Dcsd cs_dalloc(int m, int n) {
        Dcsd D;
        D = new Dcsd();
        D.p = new int[m];
        D.r = new int[m + 6];
        D.q = new int[n];
        D.s = new int[n + 6];
        D.cc = new int[5];
        D.rr = new int[5];
        return D;
    }
784578
public String shortOrdinal(Long n) {
        return (n == null) ? null : shortOrdinal(n.longValue());
    }
1217530
private final int m() {
        int n = 0;
        int i = 0;
        for (; cons(i); ++i) {
            if (i > j)
                return n;
        }
        i++;
        while(i <= j) {
            for (; !cons(i); ++i) {
                if (i > j)
                    return n;
            }
            i++;
            n++;

            if (i > j)
                return n;
            for (; cons(i); ++i) {
                if (i > j)
                    return n;
            }
            i++;
        }
        return n;
    }
801618
public static byte[] randomBytes(int n) {
        byte[] buffer = new byte[n];
        if (RandomUtils.secureRandom == null) {
            try {
                RandomUtils.secureRandom = SecureRandom.getInstance(ALGORITHM);
            } catch (NoSuchAlgorithmException e) {
                e.printStackTrace();
            }
        }
        RandomUtils.secureRandom.nextBytes(buffer);
        return buffer;
    }
16690
public static long factoriall(int n) {
        checkNonNegative("n", n);
        return (n < long_factorials.length) ? long_factorials[n] : Long.MAX_VALUE;
    }
248884
public static int ceiling(int n, int m) {
        return n >= 0 ? ((n + m - 1) / m) * m : (n / m) * m;
    }
690127
public String next(int n) throws JSONException {

        if (n == 0) {
            return "";
        }

        char[] buffer = new char[n];
        int pos = 0;

        if (m_useLastChar) {
            m_useLastChar = false;
            buffer[0] = m_lastChar;
            pos = 1;
        }

        try {
            int len = m_reader.read(buffer, pos, n - pos);
            while ((pos < n) && (len != -1)) {
                pos += len;
                len = m_reader.read(buffer, pos, n - pos);
            }
        } catch (IOException exc) {
            throw new JSONException(exc);
        }
        m_index += pos;

        if (pos < n) {
            throw syntaxError("Substring bounds error");
        }

        m_lastChar = buffer[n - 1];
        return new String(buffer);
    }