Search for the minimum element in the array.

@param charArray array that we are searching in.

@return the minimum element in the array.
483956
public static char searchMin(char[] charArray) {
        if(charArray.length == 0) {
            throw new IllegalArgumentException("The array you provided does not have any elements");
        }

        char min = charArray[0];

        for(int i = 1; i < charArray.length; i++) {
            if(charArray[i] < min) {
                min = charArray[i];
            }
        }

        return min;
    }
554546
public Pair<T> min() {
        int minCount = Integer.MAX_VALUE;
        TLongIntIterator iter = counts.iterator();
        long minIndex = 0;

        while (!iter.hasNext()) {
            iter.advance();

            int count = iter.value();
            if (count < minCount) {
                minIndex = iter.key();
                minCount = count;
            }
        }
        if (minCount == Integer.MAX_VALUE)
            return null;
        
        int i = (int)(minIndex >>> 32);
        int j = (int)(minIndex & 0xfffffff);
        return new Pair<T>(elementIndices.lookup(i), 
                           elementIndices.lookup(j));
    }
159234
public int compareTo(OffsetCharSequence other) {
        int len1 = length();
        int len2 = other.length();
        int lim = Math.min(len1, len2);

        for (int i = 0; i  < lim; i++) {
            char c1 = charAt(i);
            char c2 = other.charAt(i);
            if (c1 != c2) {
                return c1 - c2;
            }
        }
        return len1 - len2;
    }
88375
@Override
	public char[] getTextCharacters(int[] poslen) {
		String text = getText();
		if (text == null) {
			poslen[0] = -1;
			poslen[1] = -1;
			return null;
		}
		char[] result = text.toCharArray();
		poslen[0] = 0;
		poslen[1] = result.length;
		return result;
	}
507426
public static CharPredicate among(final String chars) {
    return new CharPredicate() {
      @Override public boolean isChar(char c) {
        return chars.indexOf(c) >= 0;
      }
      @Override public String toString() {
        return '[' + chars + ']';
      }
    };
  }
520403
public final boolean contains(char[] a) {
        final int last_pos = off + len - a.length;
        outer:
        for (int pos = off; pos <= last_pos; ++pos) {
            for (int a_off = 0; a_off < a.length; ++a_off) {
                if (a[a_off] != fb[pos + a_off]) {
                    continue outer;
                }
            }
            return true;
        }
        return false;
    }
710582
private boolean charsMatch(char[] chars, int pos1, int pos2, int len2) {
        return charsMatch(chars, pos1, len2, pos2, len2);
    }
348396
public static long searchMin(long[] longArray) {
        if(longArray.length == 0) {
            throw new IllegalArgumentException("The array you provided does not have any elements");
        }

        long min = longArray[0];

        for(int i = 1; i < longArray.length; i++) {
            if(longArray[i] < min) {
                min = longArray[i];
            }
        }

        return min;
    }
766461
public static double min(Array array) throws PageException {
	if (array.getDimension() > 1) throw new ExpressionException("can only get max value from 1 dimensional arrays");
	if (array.size() == 0) return 0;

	double rtn = _toDoubleValue(array, 1);
	int len = array.size();
	try {
	    for (int i = 2; i <= len; i++) {
		double v = _toDoubleValue(array, i);
		if (rtn > v) rtn = v;

	    }
	}
	catch (PageException e) {
	    throw new ExpressionException("exception while execute array operation: " + e.getMessage());
	}
	return rtn;
    }
736831
@Override
    public char[] read(ScanBuffer buffer) {
        int length = getLength(buffer);
        if (length<0) return null;
        return buffer.getChars(length);
    }
1038740
public static byte searchMax(byte[] byteArray) {
        if(byteArray.length == 0) {
            throw new IllegalArgumentException("The array you provided does not have any elements");
        }

        byte max = byteArray[0];

        for(int i = 1; i < byteArray.length; i++) {
            if(byteArray[i] > max) {
                max = byteArray[i];
            }
        }

        return max;
    }
219387
public int min() {
    int min = Integer.MAX_VALUE;
    for (E key : map.keySet()) {
      min = Math.min(min, getIntCount(key));
    }
    return min;
  }
954028
public static int findFirstOf (String container, String chars, int begin){        
        int minIdx = -1;        
        for (int i = 0; i < chars.length() && i >= 0; ++i){
            int idx = container.indexOf(chars.charAt(i), begin);            
            if ( (idx < minIdx && idx != -1) || minIdx == -1){                    
                    minIdx = idx;
            }
        }
        return minIdx;
    }
1364239
@Pure
	public static int min(int... values) {
		if (values == null || values.length == 0) {
			return 0;
		}
		int min = values[0];
		for (final int v : values) {
			if (v < min) {
				min = v;
			}
		}
		return min;
	}
262803
private int minimumFnRemove(int[] h) {
    int minIndex = Integer.MAX_VALUE;
    double minValue = Double.MAX_VALUE;

    for (int i = 0; i < nbHash; i++) {
      double keyWeight = getWeight(keyVector[h[i]]);

      if (keyWeight < minValue) {
        minIndex = h[i];
        minValue = keyWeight;
      }

    }

    return minIndex;
  }
244377
public static int search(short[] shortArray, short value) { 
        int start = 0;
        int end = shortArray.length - 1;
        int middle = 0;
        
        while(start <= end) {
            middle = (start + end) >> 1;
        
            if(value == shortArray[middle]) {
                return middle;
            }
            
            if(value < shortArray[middle]) {
                end = middle - 1 ;
            }
            else {
                start = middle + 1;
            }
        }
                

        return -1;
    }
475472
@SafeVarargs
    public static char max(final char... a) {
        N.checkArgNotNullOrEmpty(a, "The spcified array 'a' can not be null or empty");

        return max(a, 0, a.length);
    }