private double calc(String str){
		if(str ==null || str.length() == 0){
			return -1;
		}
		StringTokenizer st = new StringTokenizer(str," ");
		Stack<Double> s = new Stack<Double>();
		String input = "";
		Double result = 0.0;
		while(st.hasMoreElements()){
			try{
				input = st.nextElement().toString();
				Double num = Double.parseDouble(input);
				s.push(num);
			} catch(Exception e){
				Double num1 = s.pop();
				Double num2 = s.pop();
				try{
					if(input.equals("+")){result = num2+num1;}
					else if(input.equals("-")){result = num2 - num1;}
					else if(input.equals("*")){result = num2 * num1;}				
					else if(input.equals("/")){result = num2/num1;}
					else {System.out.println("Not a valid input"); break;}    
				} catch(Exception ee){
					System.out.println("Divide by zero");
				}
				s.push(result);
				continue;
			}
		}
		return result;
	}