public static double toDouble(String nb){
		char[] nr=nb.toCharArray();
		int i;
		double f;
		double result=0;
		boolean fraction=false;
		if(nb==null||nb.equals(""))
			return 0;
		for(i=0;i<nr.length &&!fraction;i++)
			if(Character.isDigit(nr[i]))
				{result*=10;
				result+=(nr[i]-'0');
				}
			else
				{fraction=true;
				if(nr[i]!='.')
					return 0.0;
				}
		for(f=10;i<nr.length;i++,f*=10)
		{
			if(Character.isDigit(nr[i]))
				result+=(double)( (nr[i]-'0')/f);
			else
				return 0;
		}
		return result;
	}