public static void main(String[] args) {
String str = "154.232";
str = str.replaceAll("\\..*", "");
System.out.println(str);
}
or
str.substring(0, str.indexOf("."));
or
// check for index of .
is not -1
, then do following.
str.split(".")[0];
output
154
solved Split the number on a decimal