Shuffling numbers
One of the tiresome things about computers in general is the difficulty they have with recognising numbers. If you say to a child "add two and two" they will add the two numbers and give you four. If you say to the child "write two and two" they will write the string "two and two" or "2+2". If you subsequently asked them to solve, they will convert the string back to an equation and give you four again. My first instinct after writing code which successfully shuffles strings was to extract numbers from them. Java has various methods for converting strings to numbers. A problem with all of them in my experience is that they are fussy about the string you pass to them for conversion. Accidentally appending non-numeric characters, like commas or brackets, usually generates exceptions. Coding to handle these exceptions is fraught with problems and messy. After much thought I decided that rather than shuffling strings and converting the...