(@NotNull String version)
| 178 | } |
| 179 | |
| 180 | public static long parseVersion(@NotNull String version) { |
| 181 | long v = 0; |
| 182 | int t = 0, s = 48; |
| 183 | for (int i = 0, n = version.length(); i < n; i++) { |
| 184 | int c = version.charAt(i); |
| 185 | if (c >= '0' && c <= '9') { |
| 186 | t = t * 10 + c - '0'; |
| 187 | if (t > 0xffff) |
| 188 | throw new NumberFormatException(version); |
| 189 | } else if (c == '.') { |
| 190 | if (s == 0) |
| 191 | break; |
| 192 | v += (long)t << s; |
| 193 | t = 0; |
| 194 | s -= 16; |
| 195 | } else if (!Character.isSpaceChar(c)) |
| 196 | throw new NumberFormatException(version); |
| 197 | } |
| 198 | return v + ((long)t << s); |
| 199 | } |
| 200 | |
| 201 | public static @NotNull String toVersionStr(long version) { |
| 202 | return String.format("%d.%d.%d.%d", |
no outgoing calls