Write a method named convertToBase10 that converts its <array, base> arguments to a base 10 number if the input is legal for the specified base. If it is not, it returns -1.Your convertToBase10 method must call the isLegalNumber method. Function signature is: int convertToBase10(int[ ] a, int base)
Write a method named convertToBase10 that converts its <array, base> arguments to a base 10 number if the input is legal for the specified base. If it is not, it returns -1.Your convertToBase10 method must call the isLegalNumber method. Function signature is: int convertToBase10(int[ ] a, int base)