//package com.nowjava;
public class Main {/*来 自 时 代 Java 公 众 号 - nowjava.com*/
public static void main(String[] argv) throws Exception {
double[] v = new double[] { 34.45, 35.45, 36.67, 37.78, 37.0000,
37.1234, 67.2344, 68.34534, 69.87700 };
System.out.println(max(v));
}
/**
* Returns the maximum of an array.
*/
public static double max(double[] v) {
double max = v[0];
/** from
n o w j a v a . c o m - 时代Java**/
for (int i = 1; i < v.length; i++) {
if (max < v[i]) {
max = v[i];
}
}
return (max);
}
/**
* Returns the maximum of an array.
*/
public static double max(double[][] v) {
double max = max(v[0]);
for (int i = 1; i < v.length; i++) {
if (max < max(v[i])) {
max = max(v[i]);
}
}
return (max);
}
/**
* Returns the maximum of an array.
*/
public static int max(int[] v) {
int max = v[0];
for (int i = 1; i < v.length; i++) {
if (max < v[i]) {
max = v[i];
}
}
return (max);
}
/**
* Returns the maximum of an array.
*/
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。