private IPAddress computeMaskFromNetworkPrefix(int prefix){
  StringBuilder str=new StringBuilder();
  for (int i=0; i < 32; i++) {
    if (i < prefix) {
      str.append("1");
    }
 else {
      str.append("0");
    }
  }
  String decimalString=toDecimalString(str.toString());
  return new IPAddress(decimalString);
}

private IPAddress computeMaskFromNetworkPrefix ( int prefix ) { StringBuilder str = new StringBuilder ( ) ; for ( int i = 0 ; i < 32 ; i ++ ) { if ( i < prefix ) { str . append ( "1" ) ; } else { str . append ( "0" ) ; } } String decimalString = toDecimalString ( str . toString ( ) ) ; return new IPAddress ( decimalString ) ; }
convert a extended network prefix integer into an ip number .
