Here you can find the source of toIntStr(String floatStr)
public static String toIntStr(String floatStr)
//package com.java2s; public class Main { public static String toIntStr(String floatStr) { if (floatStr == null || floatStr.length() < 1) { return "0"; }/*from www.j av a2s . co m*/ int index = floatStr.indexOf("."); if (index == -1) return floatStr; if (index == 0) return "0"; if (index == 1 && floatStr.substring(0, 1).equals("-")) { return "0"; } String intStr = floatStr.substring(0, index); if (intStr.substring(0, 1).equals("-")) { long tmp = Long.parseLong(intStr) - 1; intStr = tmp + ""; } return intStr; } }