Can anyone convert the following code Kotlin to java

Aroo :

Someone please convert this Kotlin code to java

sharedPreferences = getSharedPreferences("ThemePref", Context.MODE_PRIVATE)

//   getTheme()applyStyle(R.style.OverlayThemeLime, true) in Java
//        theme.applyStyle(R.style.OverlayThemeBlue, true) // -> Replaced
when (sharedPreferences.getString(themeKey, "red")) {
    "lime" ->  theme.applyStyle(R.style.OverlayThemeLime, true)
    "red" ->  theme.applyStyle(R.style.OverlayThemeRed, true)
    "green" ->  theme.applyStyle(R.style.OverlayThemeGreen, true)
    "blue" ->  theme.applyStyle(R.style.OverlayThemeBlue, true)
}

I need the java code of this. P.s: I don't use Android studio so there is no option to convert.

M. S. :
sharedPreferences = getSharedPreferences("ThemePref", Context.MODE_PRIVATE);

String result = sharedPreferences.getString(themeKey, "red");
switch (result) {
    case "lime":
        getTheme().applyStyle(R.style.OverlayThemeLime, true);
        break;
    case "red":
        getTheme().applyStyle(R.style.OverlayThemeRed, true);
        break;
    case "green":
        getTheme().applyStyle(R.style.OverlayThemeGreen, true);
        break;
    case "blue":
        getTheme().applyStyle(R.style.OverlayThemeBlue, true);
        break;
    default:
        break;
}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=403685&siteId=1