Why isnt this java code working? simple calculator
<p>This is a calculator for simple arithmetic operations where only + and - is used. The logic part is pretty easy, but I am embarrassed to say the code is not working. The input is with unknown digits. eg : "4/2" or "42+34" should both should be acceptable. I am not so comfortable with strings and their functions, so please help out. Thank you! :)</p>

<pre><code>/*
 *Calculator with only + and - 
 */
import java.util.Scanner;

class Calculator {
    public static String strng;

    public static void main(String[]args){
        Calculator calc = new Calculator();
        calc.Calculator();
    }

    public void Calculator()
    {
        int op1=0,op2=0,flag=0,index=0;
        String Operator=null;
        System.out.println("java calculator");
        Scanner sc=new Scanner(System.in);

        strng= sc.nextLine();

        if(strng.indexOf("+")&gt;0) {
            Operator = "+";
            index=strng.indexOf("+");
            if(strng.lastIndexOf("+")!=index){
              Operator="++";
              flag=1;
            }
        }
        else if(strng.indexOf("-")&gt;0) {
            Operator="-";
            index=strng.indexOf("-");
            if(strng.lastIndexOf("-")!=index){
              Operator="--";
              flag=1;
            }
        } else if(strng.indexOf("*")&gt;0) {
            Operator="*";
            index=strng.indexOf("*");
        } else if(strng.indexOf("/")&gt;0) {
            Operator="/";
            index=strng.indexOf("/");
        } 

        if((index&gt;0)&amp;&amp;(flag==0)) {
           op1=Integer.parseInt(strng.substring(0,index-1));
           op2=Integer.parseInt(strng.substring(index+1));
           Operation(Operator,op1,op2);
        }

        if(flag==1) {
           op1=Integer.parseInt(strng.substring(0,index-1));
           op2=Integer.parseInt(strng.substring(index+2)); 
           Operation(Operator,op1,op2);
        } else { //to separate the operator and operands string functions.
           System.out.println("Invalid choice");
        }
     }  


     public void Operation(String Operator, int operand1, int operand2) {
        if(Operator.equals("+")){ Add(operand1,operand2); }
        if(Operator.equals("-")){ Subtract(operand1,operand2); }
        if(Operator.equals("*")){ Multiply(operand1,operand2); }
        if(Operator.equals("/")){ Divide(operand1,operand2); }
        if(Operator.equals("++")){ Increment(operand1); }
        if(Operator.equals("--")){
            Decrement(operand1);
        } else {
            System.out.println("Invalid entry");
        }
    } 


    void Add(int op1, int op2) {
        System.out.println(strng+"="+(op1+op2));
    }

    void Subtract(int op1, int op2) {
        System.out.println(strng+"="+(op1-op2));
    }  

    void Increment(int op1) {
        System.out.println(strng+"="+(op1+1));
    }

    void Decrement(int op1) {
        System.out.println(strng+"="+(op1-1));
    }

    void Multiply(int op1, int op2) {
        int ans=0;
        int  x = op1&lt;op2?op1:op2;
        int y = op1&gt;op2?op1:op2;
        for(int i=1;i&lt;=x;i++){
            ans=ans+y;
        } 
        System.out.println(strng+"="+ans);
    }

    void Divide(int op1, int op2) {
        int count=0,rem=op1;

        while(rem&gt;=op2){
            rem=rem-op2;
            count=count+1;
        } 
        System.out.println(strng+"="+count); //return rem for modulo operand
    }

}
</code></pre>
