public static void main(String[] args) throws Exception {
    
     
     
      System.out.println("***************************************************");
      System.out.println("  Using Hybrid MapReduce 3D Convex Hull Algorithm  ");
      System.out.println("***************************************************");
      
      int count=0;
      long CurrentCount=-3;
      long PreviousCount=-6;
      
      boolean FastPass=false;
      String TempDir1="/input";
      String TempDir2="/QH";
      //***********************************************************************//
      
           
      while (CurrentCount!=PreviousCount) {
           
          count++;
          PreviousCount=CurrentCount;
   
          
          System.out.println("***************************************************");
          System.out.println("Hybird MapReduce 3D Convex Hull Iteration >> "+count);
          System.out.println("***************************************************");
      
          
          
          JobConf conf7 = new JobConf();
           // Important note // All the points chunks have to be > 2 points
          conf7.setInt("n.lines.records.token", 100); 
          conf7.setNumTasksToExecutePerJvm(-1);
      
    
          Job job7 = new Job(conf7, "QH");
          job7.setJarByClass(HMR3DConvexHull.class);
          job7.setMapperClass(QHMapper.class);
    
    
          job7.setInputFormatClass(NLinesInputFormat.class);  
          job7.setReducerClass(QHReducer.class);
          job7.setMapOutputKeyClass(Text.class);
          job7.setMapOutputValueClass(Text.class);
          FileInputFormat.addInputPath(job7, new Path(TempDir1));
          FileOutputFormat.setOutputPath(job7, new Path(TempDir2));
    
          job7.waitForCompletion(true);
          
          if (count!=1){
            FileSystem fs = FileSystem.get(new Configuration());  
            fs.delete(new Path("hdfs://192.168.0.206:9000"+TempDir1+"/"), true); // delete file, true for recursive 
          }
          
          TempDir1=TempDir2;
          TempDir2="/QH"+"-"+count;
      
          org.apache.hadoop.mapreduce.Counters counters = job7.getCounters();
          
          long OutputRec=counters.findCounter("org.apache.hadoop.mapred.Task$Counter", "REDUCE_OUTPUT_RECORDS").getValue();
     
          CurrentCount=OutputRec;
          
          if ((OutputRec<=10000000)&&(OutputRec!=0)){
           
              FastPass=true;
            break;
          }
          
          
          
          
      
      }     
      
      
      //**********************************************************************//
          
      if (FastPass==true){
      

          JobConf conf8 = new JobConf();
          // Important note // All the points chunks have to be > 2 points
          conf8.setInt("n.lines.records.token", 1); 
          conf8.setNumTasksToExecutePerJvm(-1);
      
    
          Job job8 = new Job(conf8, "FinalQH");
          job8.setJarByClass(HMR3DConvexHull.class);
          job8.setMapperClass(FinalQHMapper.class);
    
    
          job8.setInputFormatClass(NLinesInputFormat.class);  
          job8.setReducerClass(FinalQHReducer.class);
          job8.setMapOutputKeyClass(Text.class);
          job8.setMapOutputValueClass(Text.class);
          FileInputFormat.addInputPath(job8, new Path(TempDir1));
          FileOutputFormat.setOutputPath(job8, new Path("/Convex-Hull-Faces"));
    
          job8.waitForCompletion(true);

          
      
      }
      
      else{
       
            System.out.println("Sorry !!! The data set is too big !!! Try to increase the threshold.");
     
      }
  
  }