public static String toHexString(BigInteger b){
  String hexValue=b.toString(16);
  StringBuffer buf=new StringBuffer(hexValue.length() * 2);
  if (hexValue.startsWith("-")) {
    buf.append("   -");
    hexValue=hexValue.substring(1);
  }
 else {
    buf.append("    ");
  }
  if ((hexValue.length() % 2) != 0) {
    hexValue="0" + hexValue;
  }
  int i=0;
  while (i < hexValue.length()) {
    buf.append(hexValue.substring(i,i + 2));
    i+=2;
    if (i != hexValue.length()) {
      if ((i % 64) == 0) {
        buf.append("\n    ");
      }
 else       if (i % 8 == 0) {
        buf.append(" ");
      }
    }
  }
  return buf.toString();
}

public static String toHexString ( BigInteger b ) { String hexValue = b . toString ( 16 ) ; StringBuffer buf = new StringBuffer ( hexValue . length ( ) * 2 ) ; if ( hexValue . startsWith ( "-" ) ) { buf . append ( "   -" ) ; hexValue = hexValue . substring ( 1 ) ; } else { buf . append ( "    " ) ; } if ( ( hexValue . length ( ) % 2 ) != 0 ) { hexValue = "0" + hexValue ; } int i = 0 ; while ( i < hexValue . length ( ) ) { buf . append ( hexValue . substring ( i , i + 2 ) ) ; i += 2 ; if ( i != hexValue . length ( ) ) { if ( ( i % 64 ) == 0 ) { buf . append ( "\n    " ) ; } else if ( i % 8 == 0 ) { buf . append ( " " ) ; } } } return buf . toString ( ) ; }
return a hexadecimal printed representation of the specified biginteger object . the value is formatted to fit on lines of at least 75 characters , with embedded newlines . words are separated for readability , with eight words ( 32 bytes ) per line .
