java fraction calculator with simplifying fractions : Hi so i have a couple of problems with my code and although i have tried i haven't found out what was wrong with it
public class FracCalc {

        public static void main(String[] args) {
            // String to test
            //String input = "5_3/4 - 6_7/8 + 3/4";
            System.out.println(produceAnswer("-3_3/4 / -2_2/3"));
        }
    
        public static String produceAnswer(String input) {
    
            // Splits everything at every space
            String[] array = input.split(" ", 0);
    
            int allWholes = 0;
            int allNumerators = 0;
            int allDenominators = 1;
    
            // Multiplier is 1 or -1, 1 is add, -1 is subtract
            int multiplier = 1;
            // Operation mode; 0=+,-; 1=*; 2=/
            int mode = 0;
            
            // the for loop is used to identify and solve the the test
            for (int i = 0; i < array.length; i++) {
                String part = array[i];
                // 
                int whole = 0;
                int numerator = 0;
                int denominator = 0;
    
                // If it has a _, then it's a whole + fraction
                if (part.contains("_")) {
    
                    // Convert Int from start of part (0) to the character before _, "55_30/40" -> 55
    
                    whole = Integer.parseInt(part.substring(0, part.indexOf("_")));
    
                    // Convert Int from the character AFTER _ to the character before /, "55_30/40" -> 30
    
                    numerator = Integer.parseInt(part.substring(part.indexOf("_") + 1, part.indexOf("/")));
    
                    // Convert Int from the character AFTER / to the end, "55_30/40" -> 40
    
                    denominator = Integer.parseInt(part.substring(part.indexOf("/") + 1, part.length()));
                }
                // If no _, but still has a / AND it is not just the symbol "/", then it's just a fraction
                else if (part.contains("/") && part.length() != 1) {
                    numerator = Integer.parseInt(part.substring(0, part.indexOf("/")));
                    denominator = Integer.parseInt(part.substring(part.indexOf("/") + 1, part.length()));
                } //else if(part.contains("*") && part.contains("/")){}
                else if (part.contains("/") ) {
                    mode = 2;
                }
                // TODO: Make multiplication
                
                // Negative sign(if number is negative)
                else if (part.contains("-")) {
                    multiplier = -1;
                }
                // Positive sign(if number is positive)
    
                else if (part.contains("+")) {
                    multiplier = 1;
                }
                // If neither _ nor /, then it's a whole
                else {
                    whole = Integer.parseInt(part);
                }
    
                // Add all the wholes together
                allWholes += whole * multiplier;
    
                // If denom is the same
                if (denominator == allDenominators) {
                    allNumerators += numerator * multiplier;
                }
                // If they're not the same
                else if (numerator != 0 && denominator != 0) {
                    if (mode == 0 ) {
                        // Cross multiply
                        allNumerators *= denominator;
        
                        // Add
                        allNumerators += numerator * allDenominators * multiplier;
                        
        
                        // Second part of cross multiply
                        allDenominators *= denominator;
                    }
                    // Multiplication
                    else if (mode == 1) {
                        
                        allDenominators *= denominator;
                        
                        allNumerators *= numerator;
                        
                    }
                    // Division
                    else if (mode == 2) {
                        // Reverse multiply because (1/2)/(1/2) -> (1*1)/(2*2)
                        allNumerators = allNumerators * denominator;
                        allDenominators = allDenominators * numerator;
                    }
                }
            }
            
            // Simplifies fraction by checking to see id the top is bigger than bottom
            // 9/4 -> 2_1/4
            
            
            while(allNumerators > allDenominators){
                 allWholes = allNumerators / allDenominators;
                 allNumerators %= allDenominators;
            }
            
    
            if (allWholes == 0) {
                return (allNumerators + "/" + allDenominators);
            }
            else if (allNumerators == 0 || allDenominators == 0) {
                return allWholes + "";
            }
            else {
                return allWholes + "_" + (allNumerators + "/" + allDenominators);
            }
        }
    }


My goal is too make a fraction calculator with a simplified answer (as a fraction) here is my code so far, i am pretty sure my multiplication, division and simplifying while loop is my problem. Thank you