Java-Min and max values of an array using Collections -



Java-Min and max values of an array using Collections -

im trying max , min values 1 dimesional array as

double[] source = {1.2,1.3,1.9,0.9,0.10}; double[][] maxar = new double[10][ 5]; double x=collections.max(source); double y=collections.min(source);

the compiler run-time errors :

exception in thread "main" java.lang.error: unresolved compilation problems: method max(collection<? extends t>) in type collections not applicable arguments (double[]) method min(collection<? extends t>) in type collections not applicable arguments (double[])

any help highly appreciated ?

you can utilize apache commons lang bundle , solve same.

double[] doublearray = arrayutils.toobject(source); list<double> list = arrays.aslist(doublearray); double x=collections.max(list); double y=collections.min(list); system.out.println(x); system.out.println(y);

java

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -