public static int CMM2(int[] dimension, int[][] array, String[][] sequence, int start, int end){
		if (start >= end) return 0;
		int temp;
		for(int i = start; i < end; i++){
			if(array[start][i] == Integer.MAX_VALUE)
				array[start][i] = CMM2(dimension, array, sequence, start, i);
			if(array[i+1][end] == Integer.MAX_VALUE)
				array[i+1][end] = CMM2(dimension, array, sequence, i+1, end);
			temp = array[start][i] + array[i+1][end] + dimension[start]*dimension[i+1]*dimension[end+1];
			if (array[start][end] > temp){
				array[start][end] = temp;
				sequence[start][end] = "(" + sequence[start][i] + ")" + "(" + sequence[i+1][end] + ")";
			}
		}
		return array[start][end];
	}