But it's not working this part to get the number, someone has a light to work, because what I used the net is not working. Note: this is not an error!
public class JavaApplication1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner(System.in);
String exp;
Fila fila = new Fila();
Pilha pilha = new Pilha();
int valor;
try {
System.out.println("Digite um texto.");
exp = input.next();
StringTokenizer st = new StringTokenizer(exp, "+-*/^()", true);
while (st.hasMoreTokens()) {
if (campoNumerico(st.nextToken())) {
try {
valor = Integer.parseInt(st.toString());
fila.insere(st);
} catch (NumberFormatException e) {
System.out.println("Numero com formato errado!");
}
} else {
pilha.empilhar(st.nextToken());
}
// String delimitador;
// Float.parseFloat(st.nextToken());
}
fila.mostrar();
} catch(Exception erro) {
}
System.out.println("Valores pilha: " + pilha);
}
private static boolean campoNumerico(String campo){
return campo.matches("[0-9]+");
}
}