Finding the maximum and minimum values in list<double[]> in Java

Source: Internet
Author: User

If you want to reprint please indicate the source: http://blog.csdn.net/itas109

QQ Technology Group: 129518033

Reference:http://stackoverflow.com/questions/8093163/min-max-values-of-a-listdouble

Now there is an array of the following, with the maximum and minimum values

list<double[]> values = new arraylist<double[]> () Values.add (new double[] {12.3, 12.5, 13.8, 16.8, 20.4, 24.4 , 26.4, 26.1, 23.6, 20.3, 17.2,    13.9}); Values.add (new double[] {Ten, ten, N, N, A, (), (+), (+), (+), (+), (+), ()); VA Lues.add (New double[] {5, 5.3, 8, 9,, 9, 24.2, 6}); Values.add (new double[] {10, 11, 15, 19, 23,, 26, 25, 22, 18, 13, 10});


To find the maximum value:

Public double Listdoublearraymax (list<double[]> dataList) {Double max = double.min_value;for (double[] Ds:datalis T) {for (double d:ds) {if (d > Max) {max = D;}}} return Max;}


To find the minimum value:

Public double listdoublearraymin (list<double[]> dataList) {double min = double.max_value;for (double[] Ds:datalis T) {for (double d:ds) {if (D < min) {min = D;}}} return min;}


If you want to reprint please indicate the source: http://blog.csdn.net/itas109

QQ Technology Group: 129518033

Finding the maximum and minimum values in list<double[]> in Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.