Skip to content

Commit

Permalink
Fixed : 修复long[]和String[]转化为version信息时,长度过长
Browse files Browse the repository at this point in the history
  • Loading branch information
TinyZzh committed May 14, 2016
1 parent 0977d82 commit de0ef05
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion okra-utilities/src/main/java/org/ogcs/utilities/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
* <br/>
* The long version code(like 98784968668 = 8 byte) is much smaller than string version code(like "23.10.65500" = 22 byte)
*
* @author TinyZ on 2015/5/18.
* @author TinyZ.
* @since 1.0
*/
public final class Version {

Expand All @@ -51,6 +52,7 @@ private Version() {
/**
* Convert version code string to long version code
* <p>Example ("23.10.65500") convert to 98784968668</p>
*
* @param codes The string version . org.ogcs.okra.example ["2", "23", "6500"]
* @return The long version code
*/
Expand All @@ -61,10 +63,14 @@ public static long version(String codes) {
/**
* Convert version code string to long version code
* <p>Example ["23", "10", "65500"] convert to 98784968668</p>
*
* @param codes The string version .
* @return The long version code
*/
public static long version(String... codes) {
if (codes.length > 4) {
return -1L;
}
long version = 0;
int length = codes.length;
for (int i = 0; i < length; i++) {
Expand All @@ -81,10 +87,14 @@ public static long version(String... codes) {
/**
* Convert version int array code to long version code
* <p>Example [23, 10, 65500] convert to 98784968668</p>
*
* @param codes The string version .
* @return The long version code
*/
public static long version(int... codes) {
if (codes.length > 4) {
return -1L;
}
long version = 0;
int length = codes.length;
for (int i = 0; i < length; i++) {
Expand Down

0 comments on commit de0ef05

Please # to comment.