public static void print(final PrintStream out,final String name,final Percentile p){
  if (p.isReady()) {
    try {
      final StringBuilder sb=new StringBuilder(512);
      final float[] q=p.getQuantiles();
      final float[] e=p.getEstimates();
      final int SCREENWIDTH=80;
      sb.append(name);
      sb.append(", min(");
      sb.append(p.getMin());
      sb.append("), max(");
      sb.append(p.getMax());
      sb.append(')');
      sb.append("\n");
      final float max=e[e.length - 1];
      for (int i=0; i < q.length; i++) {
        sb.append(String.format("%4.3f",q[i]));
        sb.append(": ");
        final int len=(int)(e[i] / max * SCREENWIDTH);
        for (int j=0; j < len; j++) {
          sb.append('#');
        }
        sb.append(" ");
        sb.append(String.format("%4.3f\n",e[i]));
      }
      out.println(sb.toString());
    }
 catch (    InsufficientSamplesException e) {
    }
  }
}

public static void print ( final PrintStream out , final String name , final Percentile p ) { if ( p . isReady ( ) ) { try { final StringBuilder sb = new StringBuilder ( 512 ) ; final float [ ] q = p . getQuantiles ( ) ; final float [ ] e = p . getEstimates ( ) ; final int SCREENWIDTH = 80 ; sb . append ( name ) ; sb . append ( ", min(" ) ; sb . append ( p . getMin ( ) ) ; sb . append ( "), max(" ) ; sb . append ( p . getMax ( ) ) ; sb . append ( ')' ) ; sb . append ( "\n" ) ; final float max = e [ e . length - 1 ] ; for ( int i = 0 ; i < q . length ; i ++ ) { sb . append ( String . format ( "%4.3f" , q [ i ] ) ) ; sb . append ( ": " ) ; final int len = ( int ) ( e [ i ] / max * SCREENWIDTH ) ; for ( int j = 0 ; j < len ; j ++ ) { sb . append ( '#' ) ; } sb . append ( " " ) ; sb . append ( String . format ( "%4.3f\n" , e [ i ] ) ) ; } out . println ( sb . toString ( ) ) ; } catch ( InsufficientSamplesException e ) { } } }
print a nice histogram of percentiles
