public class stf { public stf() {} public float getFloat(String str){ float begin=0, end=0; boolean isPOINT=false; char c=' '; int begini=1, endi=1; for(int i = str.length()-1; i>=0; i--){ c=str.charAt(i); if(c == '.' && !isPOINT){ isPOINT = true; continue; } if(c >= '0' && c <= '9'){ if(isPOINT){ begin += (c-48)*begini; begini*=10; } else{ end += (c-48)*endi; endi*=10; } } else{ begin=0; end = 0; break; } } if(!isPOINT){ begin=end; end=0; } begin += (end/endi); if(str.charAt(0) == '-') begin = -1*begin; return begin; } }