检查数组是否已经排好序

@param nums 数组

@return {@link Boolean}
191153
public static boolean isSorted(int[] nums) {
        boolean desc = nums[0] - nums[nums.length - 1] >= 0;
        for (int i = 0; i < nums.length - 1; i++) {
            if (!desc && nums[i] > nums[i + 1]) {
                return false;
            }
            if (desc && nums[i] < nums[i + 1]) {
                return false;
            }
        }
        return true;
    }
1301053
function(num) {
        var count; // int
        var nptr; // int

        /* Quick check. */
        //if (num == BCG(_zero_)) return TRUE;

        /* Initialize */
        count = num.n_len + num.n_scale;
        nptr = 0; //num->n_value;

        /* The check */
        while ((count > 0) && (num.n_value[nptr++] === 0)) {
            count--;
        }

        if (count !== 0) {
            return false;
        } else {
            return true;
        }
    }
165584
public boolean getExclusiveMin() {
        if (property instanceof AbstractNumericProperty) {
            AbstractNumericProperty numericProperty = (AbstractNumericProperty) property;
            return BooleanUtils.isTrue(numericProperty.getExclusiveMinimum());
        }
        return false;
    }
1066324
public static String times(final Number num)
    {
        java.text.MessageFormat f = new java.text.MessageFormat(
                context.get().getBundle().getString("times.choice"),
                currentLocale()
                );
        return f.format(new Object[] { Math.abs(num.intValue()) });
    }
720103
public boolean isNumber() {
        return ( this.simpleType == SimpleValueType.INTEGER ||
                 this.simpleType == SimpleValueType.DECIMAL ||
                 this.simpleType == SimpleValueType.CHAR || 
                 this.simpleType == SimpleValueType.NUMBER ) ;
    }
265708
def get_number(string_nums):
    
    match = re.match(r".*([\d]{1,})", string_nums)
    if match:
        return int(match.group(1))
    return None
278681
function (num) {
      switch (typeof num) {
        case 'number':
          return num;
        case 'string':
          if (!isNaN(num)) {
            return num.indexOf('.') > -1 ? parseFloat(num) : parseInt(num, 10);
          }
      }

      return num;
    }
863572
public boolean containsNaN() {
        for (int i = 0; i < values.length; i++) {
            if (s.isNaN(values[i])) {
                return true;
            }
        }
        return false;
    }
457287
private boolean checkNumArguments() {
        //Also, since we're iterating over all options and args, use this opportunity to recreate the commandLineString
        final StringBuilder commandLineString = new StringBuilder();
        try {
            for (final OptionDefinition optionDefinition : optionDefinitions) {
                final String fullName = prefixDot + optionDefinition.name;
                final StringBuilder mutextOptionNames = new StringBuilder();
                for (final String mutexOption : optionDefinition.mutuallyExclusive) {
                    final OptionDefinition mutextOptionDef = optionMap.get(mutexOption);
                    if (mutextOptionDef != null && mutextOptionDef.hasBeenSet) {
                        mutextOptionNames.append(' ').append(prefixDot).append(mutextOptionDef.name);
                    }
                }
                if (optionDefinition.hasBeenSet && mutextOptionNames.length() > 0) {
                    messageStream.println("ERROR: Option '" + fullName +
                            "' cannot be used in conjunction with option(s)" +
                            mutextOptionNames.toString());
                    return false;
                }
                if (optionDefinition.isCollection) {
                    final Collection<?> c = (Collection<?>) optionDefinition.field.get(optionDefinition.parent);
                    if (c.size() < optionDefinition.minElements) {
                        messageStream.println("ERROR: Option '" + fullName + "' must be specified at least " +
                                optionDefinition.minElements + " times.");
                        return false;
                    }
                } else if (!optionDefinition.optional && !optionDefinition.hasBeenSet &&
                        !optionDefinition.hasBeenSetFromParent && mutextOptionNames.length() == 0) {
                    messageStream.print("ERROR: Option '" + fullName + "' is required");
                    if (optionDefinition.mutuallyExclusive.isEmpty()) {
                        messageStream.println(".");
                    } else {
                        messageStream.println(" unless any of " + optionDefinition.mutuallyExclusive +
                                " are specified.");
                    }
                    return false;
                }
            }

            if (positionalArguments != null) {
                final Collection<?> c = (Collection<?>) positionalArguments.get(callerOptions);
                if (c.size() < minPositionalArguments) {
                    messageStream.println("ERROR: At least " + minPositionalArguments +
                            " positional arguments must be specified.");
                    return false;
                }
                for (final Object posArg : c) {
                    commandLineString.append(' ').append(posArg.toString());
                }
            }
            //first, append args that were explicitly set
            for (final OptionDefinition optionDefinition : optionDefinitions) {
                if (optionDefinition.hasBeenSet) {
                    commandLineString.append(' ').append(prefixDot).append(optionDefinition.name).append('=').append(
                            optionDefinition.field.get(optionDefinition.parent));
                }
            }
            commandLineString.append("   "); //separator to tell the 2 apart
            //next, append args that weren't explicitly set, but have a default value
            for (final OptionDefinition optionDefinition : optionDefinitions) {
                if (!optionDefinition.hasBeenSet && !optionDefinition.defaultValue.equals("null")) {
                    commandLineString.append(' ').append(prefixDot).append(optionDefinition.name).append('=').append(
                            optionDefinition.defaultValue);
                }
            }
            this.commandLine += commandLineString.toString();
            return true;
        } catch (final IllegalAccessException e) {
            // Should never happen because lack of publicness has already been checked.
            throw new RuntimeException(e);
        }
    }
1101197
static Integer numerator(final String s) {
        if ("".equals(s)) {
            return null;
        }
        String[] tokens = s.split("/");
        return emptyToNullInteger(tokens[0]);
    }
381869
public static boolean isAllNum(String str)
    {
        if (str == null)
            return false;

        int i = 0;
        /** 判断开头是否是+-之类的符号 */
        if ("±+-＋－—".indexOf(str.charAt(0)) != -1)
            i++;
        /** 如果是全角的０１２３４５６７８９ 字符* */
        while (i < str.length() && "０１２３４５６７８９".indexOf(str.charAt(i)) != -1)
            i++;
        // Get middle delimiter such as .
        if (i > 0 && i < str.length())
        {
            char ch = str.charAt(i);
            if ("·∶:，,．.／/".indexOf(ch) != -1)
            {// 98．1％
                i++;
                while (i < str.length() && "０１２３４５６７８９".indexOf(str.charAt(i)) != -1)
                    i++;
            }
        }
        if (i >= str.length())
            return true;

        /** 如果是半角的0123456789字符* */
        while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
            i++;
        // Get middle delimiter such as .
        if (i > 0 && i < str.length())
        {
            char ch = str.charAt(i);
            if (',' == ch || '.' == ch || '/' == ch  || ':' == ch || "∶·，．／".indexOf(ch) != -1)
            {// 98．1％
                i++;
                while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
                    i++;
            }
        }

        if (i < str.length())
        {
            if ("百千万亿佰仟%％‰".indexOf(str.charAt(i)) != -1)
                i++;
        }
        if (i >= str.length())
            return true;

        return false;
    }
1241167
public static <A extends Number & Comparable<?>> NumberExpression<Integer> sign(Expression<A> num) {
        return Expressions.numberOperation(Integer.class, Ops.MathOps.SIGN, num);
    }
417427
public static <T> T[][] copyOf(final T[][] nums) {
        final int lengthY = Array.getLength(nums);
        int lengthX = 0;
        if (Array.getLength(nums) > 0) {
            lengthX = Array.getLength(nums[0]);
        }
        @SuppressWarnings("unchecked")
        final T[][] copy = (T[][]) Array.newInstance(nums.getClass().getComponentType().getComponentType(), lengthY,
                lengthX);
        for (int i = 0; i < copy.length; i++) {
            @SuppressWarnings("unchecked")
            final T[] member = (T[]) Array.newInstance(nums[i].getClass().getComponentType(), nums[i].length);
            System.arraycopy(nums[i], 0, member, 0, nums[i].length);
            copy[i] = member;
        }
        return copy;
    }
645698
public static Integer[] splitNumSeq(final String numSeq) {
    if (isEmpty(numSeq)) { return null; }
    String[] numArray = split(numSeq, ',');
    Set<Integer> numSet = CollectUtils.newHashSet();
    for (int i = 0; i < numArray.length; i++) {
      String num = numArray[i];
      if (num.contains("-")) {
        String[] termFromTo = split(num, '-');
        int from = Numbers.toInt(termFromTo[0]);
        int to = Numbers.toInt(termFromTo[1]);
        for (int j = from; j <= to; j++) {
          numSet.add(Integer.valueOf(j));
        }
      } else {
        numSet.add(new Integer(num));
      }
    }
    Integer[] nums = new Integer[numSet.size()];
    numSet.toArray(nums);
    return nums;
  }
68799
public long numParams() {
        int ret = 0;
        for (Map.Entry<String, INDArray> entry : params.entrySet()) {
            ret += entry.getValue().length();
        }
        return ret;
    }
623391
public static boolean hasNaN( DMatrixD1 m )
    {
        int length = m.getNumElements();

        for( int i = 0; i < length; i++ ) {
            if( Double.isNaN(m.get(i)))
                return true;
        }
        return false;
    }
498094
public static int assertIsPositive(int num, String fieldName) {
        if (num <= 0) {
            throw new IllegalArgumentException(String.format("%s must be positive", fieldName));
        }
        return num;
    }