You could loop through this array checking if the current number was bigger than the last. If it was, assign it to your biggest number variable. Or you could sort the array and grab the first/last element as is appropriate.
What's wrong with the suggestion you originally posted? It works.
Actually there are three improvements I would suggest:
The name of the class "SampleProgram" does not describe what the class does. Suggest you change it.
The static field max is unnecessary; use a local variable instead.
The enhanced for loop (for-each loop) would be better than an ordinary for loop if you are using Java5 or Java6.
Apart from that, it is a perfectly acceptable maximum-finding application. You are already doing what Paul suggested, and using a TreeSet is probably beyond the stage you have reached in learning Java.