I m trying to find the minimum number but i keep geting the max some some help he?
java help

import java.util.Scanner;

import java.util.Arrays;

import java.text.*;

public class p171ex6a{

	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
	
	int numk;
	
	numk = scan.nextInt();
	
	double num;
	
	double [] max = new double[numk];
	
	for (int in=0;in<numk;in++)
	{
		num = scan.nextDouble();
		
		max [in]= num;
	}
	
	DecimalFormat df = new DecimalFormat("0.0000");	
	Arrays.sort(max);	
	System.out.println(df.format(max[max.length-1]));
	
		

	}

}
I m trying to find the minimum number but i keep geting the max some some help he?
===

java help

import java.util.Scanner;

import java.util.Arrays;

import java.text.*;

public class p171ex6a{

	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
	
	int numk;
	
	numk = scan.nextInt();
	
	double num;
	
	double [] max = new double[numk];
	
	for (int in=0;in<numk;in++)
	{
		num = scan.nextDouble();
		
		max [in]= num;
	}
	
	DecimalFormat df = new DecimalFormat("0.0000");	
	Arrays.sort(max);	
	System.out.println(df.format(max[max.length-1]));
	
		

	}

}