I have the following string in Java:
"Send data to port 2112 with this entire message intact"
What is a good way to extract the number from the string and place "2112" in an integer?
I know some "brute force or hard" ways to do this but I am looking for something that uses good Java programming techniques.
What I am actually doing here is testing that ports are available---so i send a message to a server on port 2112 and tell it to send me back the same message on the specified port.