Ok, how does one determine the size of a text field from the maxInclusive="12345" field of a XML Schema xsd:element? Does one do this (packed into one statement or many as tastes dictate)...
String
maxInclusive = element.getAttribute("maxInclusive");
double d
= Double.parseDouble(maxInclusive);
d = Math.log(d + .9); //
for the case of 100, we need 3 not 2
d /= Math.log(10);
d = Math.ceil(d);
return (int)d;
That's what I intially did. Too much time spent in math classes
in high scool and college I guess. That blinded me to the more elegant solution...
return element.getAttribute("maxInclusive").length().
And I even spent time looking online to verify that log10(x)
is ln(x)/ln(10) after the guy with a degree in statistics couldn't remember
for certian!