Created
March 20, 2010 15:28
-
-
Save v6ak/338718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package v6.micro.platforms; | |
public final class Platform { | |
private static final String JP_PREFIX = "JP-"; | |
private Platform() {} | |
public static boolean isA200OrHigher() { | |
return isA200OrHigher(System.getProperty("com.sonyericsson.java.platform")); | |
} | |
public static boolean isA200OrHigher(String javaPlatformProperty) { | |
if(javaPlatformProperty == null){ | |
return false; | |
} | |
if(!javaPlatformProperty.startsWith(JP_PREFIX)){ | |
return false; | |
} | |
final int dotPos = javaPlatformProperty.indexOf("."); | |
final int end = (dotPos == -1) | |
? javaPlatformProperty.length() | |
: dotPos; | |
final int majorVersion; | |
try{ | |
majorVersion = Integer.parseInt(javaPlatformProperty.substring(JP_PREFIX.length(), end)); | |
}catch (NumberFormatException e) { | |
return false; | |
} | |
return majorVersion >= 8; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment