code: public static void putDouble(final String key, final double value) {
          final Editor editor = getPreferences().edit();
          editor.putLong(key, Double.doubleToRawLongBits(value));
          editor.apply();
      }
docs: Stores a double value as a long raw bits value.
  
  @param key   The name of the preference to modify.
  @param value The double value to be save in the preferences.
  @see android.content.SharedPreferences.Editor#putLong(String, long)