static void resampleProcess(int newR) throws IOException{
		/*
		 * Determine the threshold for resampling
		 */
		long indexsize = index.size();
		int threshold = -1;
		long c = 0;
		estiRatio = getEstimateRatio();
		measuredRatio = (double)dup/total/estiRatio;
		
		resultRecord.println("Total chunks are: " + totalChunkNum
				+ "\nOriginal samplingrate is: " + (double)1/migratePara/newR
				+"\nCurrent sampling rate is: " + (double)1/newR
				+ "\nEstimated ratio is: " + estiRatio
				+"\nMeasured rate is " + (double)dup/total
				+ "\nRequired normalized ratio is: " + requiredRatio
				+ "\nCurrent normalized ratio is: " + measuredRatio
				);
		resultRecord.println("\nThe amount of evicted chunks is: " +(double)1/migratePara/newR*totalChunkNum*estiRatio*(requiredRatio - measuredRatio));

		
		System.out.println("Total chunks are: " + totalChunkNum
							+ "\nsamplingrate is: " + (double)1/newR
							+ "\nEstimated ratio is: " + estiRatio
							+ "\nRequired normalized ratio is: " + requiredRatio
							+ "\nCurrent normalized ratio is: " + measuredRatio);	
		System.out.println("The amount of evicted chunks is: " +(double)1/newR*totalChunkNum*estiRatio*(requiredRatio - measuredRatio));
		double evict = (double)1/newR*totalChunkNum*estiRatio*(requiredRatio - measuredRatio);
		while(c<(double)1/newR*totalChunkNum* estiRatio*(requiredRatio - measuredRatio)){
			threshold+=1 ;
		Iterator<Entry<String, long[]>> iter = index.entrySet().iterator();
		while(iter.hasNext()){
			Entry<String, long[]> entry= iter.next();
			long meta[] = new long[M+2];
			meta = entry.getValue();
			if(meta[0] == threshold){
				c++;
	//			System.out.println("Picking the qualified index entries " + c);
			}

		}
		}
		resultRecord.println("The threshold for resampling is: " + threshold);
		
		System.out.println("The threshold for resampling is: " + threshold);
			
		resample RdP = new resample(index,M,cache,containerRecord,newR*migratePara,newR,threshold
									,chunksize,  segsize, bf, bloomfilterRecord,storageFileFolder
									,reSampleStorageFolder,hashRecord,evict);
		RdP.resampleProcess();
		RdP.reDedup();	
		extraDup+=RdP.getExtradup();	
		dup += extraDup;
		resultRecord.println("The total data is: "+total+"\nThe extra duplicates are: "+RdP.getExtradup()+
				"\nCurrent dup is: " + (double)(dup)+
				"\nThe duplication rate is : " + (double)(dup)/total*100 +"%\n"
					+RdP.getLowhit()+" entries are picked out, "
					+RdP.getSpaceReclaimed()+ " entries in the index have been removed"
					+"\nOriginal index size is: "+ indexsize
					+"\nCurrent index size is; "+ (RdP.getNewIndexSize()+RdP.getIndexSize()-RdP.getSpaceReclaimed()));
		/*adjust trigger value*/
		if((double)dup/total < requiredRatio*getEstimateRatio()){
		requiredRatio = (double)dup/total/getEstimateRatio(); 
		}
		
		System.out.println("The total data is: "+total+"\nThe extra duplicates are: "+RdP.getExtradup()+
						"\nThe duplication rate is : " + (double)(dup)/total*100 +"%\n" +
							RdP.getLowhit()+" entries are picked out, "+RdP.getSpaceReclaimed()
							+ " entries in the index have been removed\nCurrent index size is; "
							+ (RdP.getNewIndexSize()+RdP.getIndexSize()-RdP.getSpaceReclaimed()));
//		System.out.println("The current BloomFilter size is: " + bf.size());
	}