I have some phone records in which epoch time is coming in exponential format like 1467.738871E9
. I need to validate those records in which number is not in proper format and drop those records.Right now, I am using big decimal,but I have heard that bigdecimal
is slow and takes more space. Since I have million of records to be validated,is there any other way to validate time which is more space and time efficient.
Code:
try {
new BigDecimal(data).toBigInteger();
} catch (NumberFormatException n) {
return false;
}
return true;