public static void main(String[] args) throws Exception { 

        Configuration conf = new Configuration();
        conf.set("fs.default.name", "hdfs://localhost:9000");
        int times = 0;
        String[] otherArgs = new GenericOptionsParser(conf,args).getRemainingArgs();
        if(otherArgs.length != 3){
        	System.err.println("Usage: KMeans K <in> <out>");
        	System.exit(2);
        }
        k = Integer.parseInt(args[0]);
        String[] strcen = new String[k];
        centerlist = strcen;
        CenterInitial(args[1], centerlist);		//初始化中心
        double s = 0;
        double shold = 0.0001;
        do{
	        Job job = new Job(conf, "KMeans");
	        job.setJarByClass(KMeans.class);
	        job.setMapperClass(MapClass.class);
	        job.setReducerClass(Reduce.class);
	        
	        job.setOutputKeyClass(Text.class);
	        job.setOutputValueClass(Text.class);
	        
        	FileSystem fs = FileSystem.get(conf);		//每次循环，都删除输出目录  
	        fs.delete(new Path(args[2]),true);
	        FileInputFormat.setInputPaths(job, new Path(otherArgs[1]));
	        FileOutputFormat.setOutputPath(job, new Path(otherArgs[2]));
	        if(job.waitForCompletion(true))  
	        {  
	            s = NewCenter(args[2]); 
	            times++;
	        }
        }while(s> shold);
        System.out.println("Iterator: " + times);	//迭代次数，即重复计算中心点的次数
        //System.exit(job.waitForCompletion(true) ? 0 : 1);
    }