Skip to content

Instantly share code, notes, and snippets.

@v6ak
Created March 20, 2010 15:28
Show Gist options
  • Save v6ak/338718 to your computer and use it in GitHub Desktop.
Save v6ak/338718 to your computer and use it in GitHub Desktop.
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