public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
compareVersion(int[] v1,
int[] v2)
Compares two version.
|
static int |
getSubversion(String version,
int portion)
Returns a portion of the specified version in an integer,
or 0 if no such portion exists.
|
static int[] |
parseVersion(String version)
Parses the specified version into an array of integer.
|
public static final int getSubversion(String version, int portion)
For example, getSubversion(0) returns the so-called major version (2 in "2.4.0"), and getSubversion(1) returns the so-called minor version (4 in "2.4.0").
Note: alpha is consider as -500, beta -300, and rc -100. Moreover, beta3 is -497 (= -500 + 3) and rc5 -95 (-100 + 5)
version - the version. The version is assumed to
a series of integer separated by a non-alphanumeric separator.portion - which portion of the version; starting from 0.
If you want to retrieve the major version, specify 0.public static final int[] parseVersion(String version)
public static final int compareVersion(int[] v1,
int[] v2)
Copyright © 2018. All rights reserved.