Critical point
Why can't you use the String.Compareto method to compare the client version number?
For example, the previous client version number was: 9.9.9, and the latest client version number of the server side was: 10.0.1. It is greater than 10.0.1, which makes the client version number more error.
Java code implementation
I tip some, and finally go to the code. The following is the comparison code of my client version number. Welcome to vomit.
Public Static Int CompareVersion (String Version1, String Version2) {if (Version1.equals (Version2)) {Return 0;} String [] Version1array =.Split ("//" // "// . "); String [] veersion2array = version2.split ("//."); int interns = 0; int minlen = math.min (version1array.length, version2array.length); int Diff = 0; While (index <minLen && (Diff = Integer.parSeint (Version1array [Index ]) -Carseint (Version2array [Index]) == 0) == 0) {Index ++;} if (Diff == 0) {for (int i = index; I <version1array.length; i ++) {if (Integer.parseint (Version1array [i])> 0) {Return 1;}} for (int i = index; I <version2array.length; i ++) {ifger.parseint (version2array [i])> 0 ) {Return -1;} Return 0;} Else {Return Diff> 0? 1: -1;}}