```
public class Solution {
public int compareVersion(String version1, String version2) {
String[] v1 = version1.split("\\.");
String[] v2 = version2.split("\\.");
int longest = v1.length > v2.length? v1.length: v2.length;
for(int i=0; i<longest; i++)
{
int ver1 = i<v1.length? Integer.parseInt(v1[i]): 0;
int ver2 = i<v2.length? Integer.parseInt(v2[i]): 0;
if(ver1> ver2) return 1;
if(ver1 < ver2) return -1;
}
return 0;
}
}
```

Any comments would be appreciated.

Basically I split the string with regex "." (it was written "\." since "." only means any character), then using looping, I tried to find out the value of the version using parseInt.

If one version has a lesser subversion than the others, it will be filled with zeros.

for example: 1 vs 1.01 --> 1.00 vs 1.01

it ran in about 230ms, any suggestion to make it faster with Java language?

What can be optimized?