Skip to content

Instantly share code, notes, and snippets.

@v6ak
Created Mar 20, 2010
Embed
What would you like to do?
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