public double getDeweyUpperLimit() {
        double result = 0.0;
        double deweyValue = 0.0;
        String workDewey = dewey;
        if(workDewey != null) {
            workDewey = workDewey.trim();
            try {
                // This valueOf simply determines if we are truly looking at a double.
                deweyValue = Double.valueOf(workDewey).doubleValue();
                if(deweyValue >= 0.0 && deweyValue < 1000.0) {
                    int deweyLen = workDewey.length();
                    if(deweyLen > 0) {
                        char lastChar = workDewey.charAt(deweyLen - 1);
                        if(lastChar == '.') {
                            workDewey = workDewey.substring(0, deweyLen - 1);
                            deweyLen--;
                            lastChar = workDewey.charAt(deweyLen - 1);
                        }
                        if(lastChar != '9') {
                            // If last char is not a 9, add one to it.
                            // Else back through, looking for non-9.
                            workDewey = workDewey.substring(0, deweyLen - 1) + (char)(lastChar + 1);
                            result = Double.valueOf(workDewey).doubleValue();
                        } else {
                            int decimalIndex = workDewey.indexOf(".");
                            int numPlacesAfterDecimal = 0;
                            if (decimalIndex != -1){ // we have a decimal point
                                numPlacesAfterDecimal = deweyLen - decimalIndex -1 ;
                            }

                            deweyValue *= (Math.pow(10, numPlacesAfterDecimal));
                            deweyValue += 1;
                            deweyValue /= (Math.pow(10, numPlacesAfterDecimal));

                            workDewey = Double.toString(deweyValue);
                            decimalIndex = workDewey.indexOf(".");
                            workDewey = MarcWorxStringHelper.leftMost(workDewey, decimalIndex+numPlacesAfterDecimal);
                            result = Double.valueOf(workDewey).doubleValue();
                        }
                    }
                }
            } catch (NumberFormatException ex) {
                // If there is bad formatting of the dewey string, the default value
                // of 0 will be returned.
            }
        }        return result;
    }