class Numbers {

    @Nullable
    public static Double parseDoubleNull(@Nullable String str) {
        if (str == null || str.isEmpty()) {
            return null;
        } else {
            try {
                final double value = Double.parseDouble(str);
                if (Double.isNaN(value) || Double.isInfinite(value)) {
                    return null;
                } else {
                    return value;
                }
            } catch (NumberFormatException e) {
                return null;
            }
        }
    }

}