If you want to convert a float value into an integer value, you have several ways to do it that depends on how do you want to round the float value.
First way is floor rounding the float value:
float myFloat = 3.14f;
int myInteger = (int)myFloat;
The output of this code will be 3, even if the myFloat value is closer to 4.
The second way is ceil rounding the float value:
float myFloat = 3.14f;
int myInteger = Math.ceil(myFloat);
The output of this code will be 4, because the rounding mode is always looking for the highest value.