Division in Java always results in zero (0)? [duplicate]
This question already has an answer here: Double value returns 0 [duplicate] 3 answers The function below gets two values from sharedpreferences, weight and height, and I use these to calculate the BMI, When I print the content of the values I get the values i have entered in the sharedprefs ( which is good) but then when i run a division operation on them, I always get 0 as a result.. Where is the error? public int computeBMI(){ SharedPreferences customSharedPreference = getSharedPreferences( "myCustomSharedPrefs", Activity.MODE_PRIVATE); String Height = customSharedPreference.getString(