How do I get this to ignore negative number and terminate when the number 0 is entered?
Please HELP

public void productTokenizer()throws IOException
        System.out.println("Enter numbers to accumlulate their total.");//Prompt user to enter data
        //System.out.println("Zero and all negative numbers will Exit the Program:");

         double sum = 0; int num = 0;

        BufferedReader br = new BufferedReader(
        new InputStreamReader(;
        String input = br.readLine();

        StringTokenizer tokenizer = new StringTokenizer(input);

        while (tokenizer.hasMoreTokens())

                        String token = tokenizer.nextToken();

            double x = Double.parseDouble(token);
            sum = sum + x;

                 System.out.println("The sum is: " + sum);


i think it can be done after converting into double please ckeck with an if condition if(x>0) then i think you can access only positive numbers