// Parsing a String to extract a number.
// Numbers in the strings have commas in them.
// Negative numbers are enclosed in ().

import java.text.DecimalFormat;
import java.text.ParseException;

// ...

// Normally you would create your patterns in static init to avoid
// the overhead of creating them on every conversion.
// Beware DecimalFormat is not thread safe.
DecimalFormat pattern = new DecimalFormat( "#,##0;(#,##0)" );

String numberString = "(1,234)";
Number n = null;
try
   {
   n = pattern.parse( numberString );
   }
catch ( ParseException e )
   {
   err.println( "oops:" + numberString );
   n = new Integer( 0 );
   }

int result = n.intValue();