public static int[] kmeans(int cluster, double[][] data, double[] dataMax, double[] dataMin, int max_itr) {//kϖ@Bef[^_ŏɑNX^̃CfbNXlƂĎzԂB
		stopWatch("Clustering by K-means method..");
		
		int size = data.length;
		int vecLen = 1 + 4*ref;
		int[] clusterIndex = new int[size]; //e_̔z
		double[][] centerModels = new double[cluster][vecLen]; //eNX^S̃p[^
		
		//_U
		for (int i=0; i<size; i++) clusterIndex[i] = (int)(cluster * Math.random());
		
		//Ce[^
		for (int itr=0; itr<max_itr; itr++) {
			
			//ɒSČvZ
			int[] dataNum = new int[cluster];
			for(int k=0; k<cluster; k++) {
				for(int j=0; j<vecLen; j++) {
					centerModels[k][j] = 0.0;
				}
			}
			for(int i=0; i<size; i++) {
				int index = clusterIndex[i];
				for(int j=0; j<vecLen; j++) {
					centerModels[index][j] += data[i][j];
				}
				dataNum[index]++;
			}
			for(int k=0; k<cluster; k++) {
				for(int j=0; j<vecLen; j++) {
					centerModels[k][j] /= dataNum[k];
				}
			}
			
			//łS̋߂NX^Ƀf[^z
			for(int i=0; i<size; i++) {
				int index = 0;
				double minval = Double.MAX_VALUE;
				for(int k=0; k<cluster; k++){
					double dist = 0.0;
					for(int j=0; j<vecLen; j++) {
						double gap = data[i][j] - centerModels[k][j];
						dist += gap * gap;
					}
					dist = Math.sqrt(dist);
					if(dist < minval) {
						minval = dist;
						index = k;
					}
				}
				clusterIndex[i] = index;
			}
		}
		
		return clusterIndex;
	}