public int[] kmeans(int cluster, double[] data, double dataMin, double dataMax, int max_itr) {//kϖ@Bef[^_ŏɑNX^̃CfbNXlƂĎzԂB
		stopWatch("Clustering by K-means method..");
		
		int size = data.length;
		int[] initCluster = new int[size];
		
		//NX^S
		double[] centers = new double[cluster];
		for (int k=0; k<cluster; k++) {
			centers[k] = dataMin + k*(dataMax - dataMin)/cluster; //WɓԊuɔzu
			//centers[k] = dataMin + (dataMax - dataMin)*Math.random(); //WŃ_ɔzu
		}
		
		//Ce[^
		for (int itr=0; itr<max_itr; itr++) {
			int cutoff = size/100;
			
			int[] dataNum2 = new int[cluster]; 
			/* ŏɃ_ꂽہAʒuāiWc牓ājolȉUȂNX^̂܂܂ɂȂĂƁAɃoONĩNX^U0ɂȂĂ܂̂ŁjB
			 * 邽߂ɂolȉ̃NX^炻̃NX^S𜓈ӓIɒB
			 */
			//łS̋߂NX^Ƀf[^z
			for(int i=0; i<size; i++) {
				double minval = Double.MAX_VALUE;
				int index = 0;
				for(int k=0; k<cluster; k++){
					double dist = Math.abs(data[i] - centers[k]);
					if(dist < minval) {
						minval = dist;
						index = k;
					}
					initCluster[i] = index;
				}
				dataNum2[index]++;
			}
			
			//SČvZ
			int[] dataNum = new int[cluster];
			for(int k=0; k<cluster; k++){
				centers[k] = 0.0;
			}
			for(int i=0; i<size; i++) {
				int index = initCluster[i];
				centers[index] += data[i];
				dataNum[index]++;
			}
			for(int k=0; k<cluster; k++) {
				if(dataNum[k]<=cutoff) continue; //ڂ͌ŋ~ςBڂ臒lcutoff𓱓
				centers[k] /= dataNum[k];
			}
			for(int k=0; k<cluster; k++) {//ڂ~
				double delta = 0.001 * (dataMax - dataMin);
				if(dataNum[k]<=cutoff) {
					int l = k;
					while (l==k || dataNum[l] <= cutoff) l = (int)(Math.random()*cluster);
					centers[k] = centers[l] + 0.5*delta;
					centers[l] = centers[l] - 0.5*delta; //ɃoĂNX^_ɎĂāÃNX^̒S𒆐SɕdeltaꂽʒuɒS点Ă炤Ƃŋ~ς
				}
			}
		}
		return initCluster;
	}