private String printOFormat(final short x){
  String sx=null;
  if (x == Short.MIN_VALUE) {
    sx="100000";
  }
 else   if (x < 0) {
    final String t=Integer.toString((~(-x - 1)) ^ Short.MIN_VALUE,8);
switch (t.length()) {
case 1:
      sx="10000" + t;
    break;
case 2:
  sx="1000" + t;
break;
case 3:
sx="100" + t;
break;
case 4:
sx="10" + t;
break;
case 5:
sx='1' + t;
break;
}
}
 else {
sx=Integer.toString(x,8);
}
return printOFormat(sx);
}

private String printOFormat ( final short x ) { String sx = null ; if ( x == Short . MIN_VALUE ) { sx = "100000" ; } else if ( x < 0 ) { final String t = Integer . toString ( ( ~ ( - x - 1 ) ) ^ Short . MIN_VALUE , 8 ) ; switch ( t . length ( ) ) { case 1 : sx = "10000" + t ; break ; case 2 : sx = "1000" + t ; break ; case 3 : sx = "100" + t ; break ; case 4 : sx = "10" + t ; break ; case 5 : sx = '1' + t ; break ; } } else { sx = Integer . toString ( x , 8 ) ; } return printOFormat ( sx ) ; }
format method for the o conversion character and short argument . for o format , the flag character ' - ' , means that the output should be left justified within the field . the default is to pad with blanks on the left . the ' # ' flag character means that the output begins with a leading 0 and the precision is increased by 1 . the field width is treated as the minimum number of characters to be printed . the default is to add no padding . padding is with blanks by default . the precision , if set , is the minimum number of digits to appear . padding is with leading 0s .
