views:

78

answers:

1

Using Apache POI, I am trying to process a large amount of numeric data. I am checking for the cell type, for instance

     case HSSFCell.CELL_TYPE_NUMERIC:
                value = String.valueOf(cell.getNumericCellValue());
                break;

Is there a way I can determine what type of numeric value the cell holds? For instance, how do I know that it is safe to cast the return value to a non-floating point value?

+1  A: 

getNumericCellValue returns double for all the numeric cells. You can check values like this:

if( Math.floor(d) == d ) {
...
}
asalamon74