java - convert primitive double array to collection

Viewed 1049

I'm looking to have an array of floats(doubles) & integers as below -

double[] myArr = {0, 0, 95, 9.5, 19, 610.5, 1217, 5.14, 4038.66, 10.23, 7961, 828, 199858, 37325.3};

I then have this function that returns the max & min

    public static void getMaxArrVal(double[] myArr) {           

        myCol = /* Code to convert myarr to collection should come here */
        System.out.println(Collections.min(myCol ));
        System.out.println(Collections.max(myCol ));
    }
}

getMaxArrVal(myArr);

I'm having problems converting primitive data type to a collection.I tried converting this to double list, tried by converting myArr to char/String to check a few things but nothing has worked obviously.

I keep seeing the compilation error of primitive data type. I did try Double too but no luck.

How could I possibly convert the array to collection & calculate min/max on this one. I'd appreciate any help her please.

6 Answers
Related