Sort the column of a java table

The below code unsets the sort for all the columns and sets the descending order to the 2nd column of the java table

On error resume next
For i=0 to JavaWindow("Administrator").JavaTable("Pending").GetROProperty("cols")-1
    JavaWindow("Administrator").JavaTable("Pending").Object.setSortMode i,0
Next
JavaWindow("Administrator").JavaTable("Pending").Object.setSortMode 2,4
On error goto 0