public static int[] findMinMax(int[] arr) {
		
		if( arr == null ){
			throw new IllegalArgumentException("Can't find max/min in NULL array"); 
		}
		
		if( arr.length == 0 ){
			throw new IllegalArgumentException("Can't find max/min in EMPTY array"); 
		}
		
		if( arr.length < 2 ){
			return new int[]{ arr[0], arr[0] }; 
		}
		
		int offset = 1;
		int min = arr[0];
		int max = arr[0];
		
		// array length is even
		if( (arr.length & 1) != 1 ){
			min = Math.min(arr[0], arr[1]);
			max = (min == arr[0] ? arr[1] : arr[0]);
			++offset;
		}
		
		int minTemp;
		int maxTemp;
		
		for( int i = offset; i < arr.length; i+=2 ){
			if( arr[i] < arr[i+1] ){
				minTemp = arr[i];
				maxTemp = arr[i+1];
			}
			else {
				minTemp = arr[i+1];
				maxTemp = arr[i];
			}

			if( minTemp < min ){
				min = minTemp;
			}
			if( maxTemp > max ){
				max = maxTemp;
			}
		}
		
		
		return new int[]{min, max};
	}