public class Solution {
    public int maximumProduct(int[] nums) {
        Arrays.sort(nums);
        int a = nums[0], b = nums[1], c = nums[2];
        int A = nums[nums.length-3], B = nums[nums.length-2], C = nums[nums.length-1];
        int max = A*B*C;
        max = Math.max(max, a*B*C);
        max = Math.max(max, a*b*C);
        max = Math.max(max, a*b*c);
        return max;
    }
}
