private void writeObject(ObjectOutputStream stream) throws IOException, ClassNotFoundException {
  ObjectOutputStream.PutField fields=stream.putFields();
  fields.put("positivePrefix",ndf.getPositivePrefix());
  fields.put("positiveSuffix",ndf.getPositiveSuffix());
  fields.put("negativePrefix",ndf.getNegativePrefix());
  fields.put("negativeSuffix",ndf.getNegativeSuffix());
  fields.put("posPrefixPattern",(String)null);
  fields.put("posSuffixPattern",(String)null);
  fields.put("negPrefixPattern",(String)null);
  fields.put("negSuffixPattern",(String)null);
  fields.put("multiplier",ndf.getMultiplier());
  fields.put("groupingSize",(byte)ndf.getGroupingSize());
  fields.put("groupingUsed",ndf.isGroupingUsed());
  fields.put("decimalSeparatorAlwaysShown",ndf.isDecimalSeparatorAlwaysShown());
  fields.put("parseBigDecimal",ndf.isParseBigDecimal());
  fields.put("roundingMode",roundingMode);
  fields.put("symbols",symbols);
  fields.put("useExponentialNotation",false);
  fields.put("minExponentDigits",(byte)0);
  fields.put("maximumIntegerDigits",ndf.getMaximumIntegerDigits());
  fields.put("minimumIntegerDigits",ndf.getMinimumIntegerDigits());
  fields.put("maximumFractionDigits",ndf.getMaximumFractionDigits());
  fields.put("minimumFractionDigits",ndf.getMinimumFractionDigits());
  fields.put("serialVersionOnStream",4);
  stream.writeFields();
}

private void writeObject ( ObjectOutputStream stream ) throws IOException , ClassNotFoundException { ObjectOutputStream . PutField fields = stream . putFields ( ) ; fields . put ( "positivePrefix" , ndf . getPositivePrefix ( ) ) ; fields . put ( "positiveSuffix" , ndf . getPositiveSuffix ( ) ) ; fields . put ( "negativePrefix" , ndf . getNegativePrefix ( ) ) ; fields . put ( "negativeSuffix" , ndf . getNegativeSuffix ( ) ) ; fields . put ( "posPrefixPattern" , ( String ) null ) ; fields . put ( "posSuffixPattern" , ( String ) null ) ; fields . put ( "negPrefixPattern" , ( String ) null ) ; fields . put ( "negSuffixPattern" , ( String ) null ) ; fields . put ( "multiplier" , ndf . getMultiplier ( ) ) ; fields . put ( "groupingSize" , ( byte ) ndf . getGroupingSize ( ) ) ; fields . put ( "groupingUsed" , ndf . isGroupingUsed ( ) ) ; fields . put ( "decimalSeparatorAlwaysShown" , ndf . isDecimalSeparatorAlwaysShown ( ) ) ; fields . put ( "parseBigDecimal" , ndf . isParseBigDecimal ( ) ) ; fields . put ( "roundingMode" , roundingMode ) ; fields . put ( "symbols" , symbols ) ; fields . put ( "useExponentialNotation" , false ) ; fields . put ( "minExponentDigits" , ( byte ) 0 ) ; fields . put ( "maximumIntegerDigits" , ndf . getMaximumIntegerDigits ( ) ) ; fields . put ( "minimumIntegerDigits" , ndf . getMinimumIntegerDigits ( ) ) ; fields . put ( "maximumFractionDigits" , ndf . getMaximumFractionDigits ( ) ) ; fields . put ( "minimumFractionDigits" , ndf . getMinimumFractionDigits ( ) ) ; fields . put ( "serialVersionOnStream" , 4 ) ; stream . writeFields ( ) ; }
writes serialized fields following serialized forms specified by java specification .
