//package com.nowjava;
public class Main {/** from n o w j a v a . c o m**/
public static void main(String[] argv) throws Exception {
double[] doubleArray = new double[] { 34.45, 35.45, 36.67, 37.78,
37.0000, 37.1234, 67.2344, 68.34534, 69.87700 };
System.out.println(isContainNegative(doubleArray));
}
/**
* This utility method checks whether a given array contains any negative
* value. It returns <tt>true </tt> if it does, <tt>false</tt> if it does
* not
*
* */
public static boolean isContainNegative(double[] doubleArray) {
boolean negativeFound = false;
int i = 0;
while (i < doubleArray.length && !negativeFound) {
if (doubleArray[i] < 0) {
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。