summaryrefslogtreecommitdiff
path: root/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicArray.java
blob: 4071cf8c754019b97deba7fa7d97fa4457b36373 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * Description: basic operations on Arrays 
 *
 * @ Author        Create/Modi     Note
 * Xiaofeng Xie    Oct. 9, 2002
 *
 */

package net.adaptivebox.global;

public class BasicArray {
  public static double getMinValue(double[] v) {
    double mv = Double.MAX_VALUE;
    for (int i=0; i<v.length; i++) {
      if (v[i]<mv) {
        mv=v[i];
      }
    }
    return mv;
  }
  public static double getMaxValue(double[] v) {
    double mv = -Double.MAX_VALUE;
    for (int i=0; i<v.length; i++) {
      if (v[i]>mv) {
        mv=v[i];
      }
    }
    return mv;
  }

}