---
# System prepended metadata

title: JavaLab-Array
tags: [JAVA]

---

# JavaLab-Array
###### tags: `JAVA`
import javax.security.auth.x500.X500Principal;

public class Arraay {

	public static void main(String[] args) {
		double[] x = {1.1,2.0,1.2,1.4,0.5,6.0}; 
		
		//double x找最大值
		double max= x[0]; 
		for(int i =1 ;i<x.length;i++) {
			if(x[i]>max) {     
				max=x[i];
				}
			}
		System.out.println(max);
		//double x找最小值
		double min=x[0];
		for(int i = 1;i<x.length;i++) {
			if(x[i]<min) {
				min=x[i];
				}
			}
		System.out.println(min);
		//double x總和
		double sum=0; 
	    	for (int i = 0; i <x.length; i++) 
	    	{
				sum = sum + x[i];
				
			}
	    	System.out.println(sum);
		}
}