자바 min()

1 개요[ | ]

Java min()
자바 min()
import java.util.Arrays;
import java.util.Collections;
public class Main {
    public static void main(String args[]) {
        Double[] nums = {3.14, 77.7, 5.0, -10.5, -4.4};
        Double min = Collections.min(Arrays.asList(nums));
        System.out.println( min );
        // -10.5
    }
}
public class Main {
    public static void main(String args[]) {
        double[] nums = {3.14, 77.7, 5.0, -10.5, -4.4};
        double min = nums[0];
        for(double i:nums)if(min>i)min=i;
        System.out.println( min );
        // -10.5
    }
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}