class MathHelper {

    public static int getOrderOfMagnitude(double number) {
        if (number == 0) {
            // this version works fine for me, but don't know, if this is mathematically correct, see:
            // http://www.mathworks.com/matlabcentral/fileexchange/28559-order-of-magnitude-of-number
            return 0;
        }
        return (int) Math.floor(Math.log10(number));
    }

    private  MathHelper();

}