I am using a pattern “#0.00##” to format numbers, it works as expected for most input. But sometimes sources number are smaller ie: 6.84378E-05, and gets converted into “0,0001”.
Is it possible to format only such numbers (not fitting standard pattern) using scientific notation? leaving all “normal” numbers intact? with single pattern.
I have to use only a single DecimalFormat pattern, without any extra code.
EDIT: To better explain why I need single DecimalFormat : I am using an external library and can only define a pattern to configure output.
You can have distinct patterns only for positive and negative values.You should do something like: