return ((BigDecimal) number).toBigInteger();
}
return new BigInteger(String.valueOf(number.intValue()));
} catch (ParseException e) {
throw new DataDecodeException("Failed to decode BigInteger value '" + data + "' using NumberFormat instance " + format + ".", e);
}
} else {
try {
return new BigInteger(data.trim());
} catch(NumberFormatException e) {
throw new DataDecodeException("Failed to decode BigInteger value '" + data + "'.", e);
}
}
}