Im doing a calculator for schoolwork and everything works except my scanner, cause when it takes a negative integer it doesnt see it as a negative number it just sees the subtraction sign as a operator and I want it to see it like a part of the operand:
String exp = "8+4*-12-4";
String[] temp = new String[exp.length()];
temp =exp.split("(?<=[-+*/])|(?=[-+*/])");
this makes it correct if its only positive integers. for example input: 8+4*12-4 and the output:[8, 4, 12, *, +, 4, -]
but with a negative number it doesnt get it right! so thats what I want help with, thanks in advance