A Regular Expression and the String.replaceAll(regex, replacement) is the answer.
Regexes are not for the feint of heart, but yours would be something like:
String result = input.replaceAll(
"\\(\\s*(\\p{Punct})\\s+(\\d+)\\s+(\\d+)\\)",
"($2 $1 $3)");
Edit.... Adrian's answer is 'about' the same as mine, and may suit you better. My answer assumes that the '/' character is any 'punctuation' character, and should be copied to the result, instead of only handling '/'.
Technically, you may want to replace \p{Punct} with something like [-+/*] (note that '-' must always come first) if you want just mathematical operators.
OK, working example:
public static void main(String[] args) {
String input = "(/ 5 6) + (/ 8 9) - (/ 12 3)";
String regex = "\\(\\s*(\\p{Punct})\\s+(\\d+)\\s+(\\d+)\\)";
String repl = "($2 $1 $3)";
String output = input.replaceAll(regex, repl);
System.out.printf("From: %s\nRegx: %s\nRepl: %s\nTo : %s\n",
input, regex, repl, output);
}
Produces:
From: (/ 5 6) + (/ 8 9) - (/ 12 3)
Regx: \(\s*(\p{Punct})\s+(\d+)\s+(\d+)\)
Repl: ($2 $1 $3)
To : (5 / 6) + (8 / 9) - (12 / 3)