private void logGraphicalMemoryUsage(MemoryUsage memoryUsage,String title){
  if (areMemoryUsageValuesCorrect(memoryUsage)) {
    double value=(double)WIDTH / memoryUsage.getMax();
    long used=Math.round(memoryUsage.getUsed() * value);
    long committed=Math.round(memoryUsage.getCommitted() * value);
    StringBuilder sb=new StringBuilder();
    sb.append(START_END_CHAR);
    sb.append('-');
    sb.append(title);
    for (int i=title.length() + 1; i < WIDTH; i++) {
      sb.append('-');
    }
    sb.append(START_END_CHAR);
    log.info(sb.toString());
    sb=new StringBuilder();
    sb.append(START_END_CHAR);
    for (int i=0; i < used; i++) {
      sb.append('/');
    }
    long pos=used;
    if (pos <= committed) {
      for (long i=pos; i < committed; i++) {
        sb.append(' ');
      }
      sb.append('|');
      pos=committed + 1L;
    }
    for (long i=pos; i < WIDTH; i++) {
      sb.append(' ');
    }
    if (committed < WIDTH) {
      sb.append(START_END_CHAR);
    }
    log.info(sb.toString());
    sb=new StringBuilder();
    sb.append(START_END_CHAR);
    for (int i=0; i < WIDTH; i++) {
      sb.append('-');
    }
    sb.append(START_END_CHAR);
    log.info(sb.toString());
  }
}

private void logGraphicalMemoryUsage ( MemoryUsage memoryUsage , String title ) { if ( areMemoryUsageValuesCorrect ( memoryUsage ) ) { double value = ( double ) WIDTH / memoryUsage . getMax ( ) ; long used = Math . round ( memoryUsage . getUsed ( ) * value ) ; long committed = Math . round ( memoryUsage . getCommitted ( ) * value ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( START_END_CHAR ) ; sb . append ( '-' ) ; sb . append ( title ) ; for ( int i = title . length ( ) + 1 ; i < WIDTH ; i ++ ) { sb . append ( '-' ) ; } sb . append ( START_END_CHAR ) ; log . info ( sb . toString ( ) ) ; sb = new StringBuilder ( ) ; sb . append ( START_END_CHAR ) ; for ( int i = 0 ; i < used ; i ++ ) { sb . append ( '/' ) ; } long pos = used ; if ( pos <= committed ) { for ( long i = pos ; i < committed ; i ++ ) { sb . append ( ' ' ) ; } sb . append ( '|' ) ; pos = committed + 1L ; } for ( long i = pos ; i < WIDTH ; i ++ ) { sb . append ( ' ' ) ; } if ( committed < WIDTH ) { sb . append ( START_END_CHAR ) ; } log . info ( sb . toString ( ) ) ; sb = new StringBuilder ( ) ; sb . append ( START_END_CHAR ) ; for ( int i = 0 ; i < WIDTH ; i ++ ) { sb . append ( '-' ) ; } sb . append ( START_END_CHAR ) ; log . info ( sb . toString ( ) ) ; } }
log a graphical version of the memory usage object . .
