public void printResult(PrintStream output,String title,Histogram other){
  output.println(title);
  if (count == 0) {
    output.println("No samples are inserted, no output!");
    return;
  }
  output.println("Samples : " + count + " ("+ other.count+ ")");
  for (int i=0; i < results.length; i++) {
    if (i == 0)     output.printf("<= %d: %d (%d)",limits[0],results[i],other.results[i]);
 else     if (i == results.length - 1) {
      output.printf("> %d: %d (%d)",limits[limits.length - 1],results[i],other.results[i]);
    }
 else {
      output.printf("%d < x <= %d: %d (%d)",limits[i - 1],limits[i],results[i],other.results[i]);
    }
    output.printf(", percentage = %.2f%% (%.2f%%) \n",(double)results[i] * 100 / count,(double)other.results[i] * 100 / other.count);
  }
  output.println();
}

public void printResult ( PrintStream output , String title , Histogram other ) { output . println ( title ) ; if ( count == 0 ) { output . println ( "No samples are inserted, no output!" ) ; return ; } output . println ( "Samples : " + count + " (" + other . count + ")" ) ; for ( int i = 0 ; i < results . length ; i ++ ) { if ( i == 0 ) output . printf ( "<= %d: %d (%d)" , limits [ 0 ] , results [ i ] , other . results [ i ] ) ; else if ( i == results . length - 1 ) { output . printf ( "> %d: %d (%d)" , limits [ limits . length - 1 ] , results [ i ] , other . results [ i ] ) ; } else { output . printf ( "%d < x <= %d: %d (%d)" , limits [ i - 1 ] , limits [ i ] , results [ i ] , other . results [ i ] ) ; } output . printf ( ", percentage = %.2f%% (%.2f%%) \n" , ( double ) results [ i ] * 100 / count , ( double ) other . results [ i ] * 100 / other . count ) ; } output . println ( ) ; }
this function prints two histograms together for comparative reading . it requires the two histograms having the same data separators .
