Java tutorial
//package com.java2s; public class Main { /** * Check new version * @param strOldVer * @param strNewVer * @return */ public static boolean checkVersion(String strOldVer, String strNewVer) { strOldVer = strOldVer.replace('.', ','); strNewVer = strNewVer.replace('.', ','); String[] oldVers = strOldVer != null ? strOldVer.split(",") : null; String[] newVers = strNewVer != null ? strNewVer.split(",") : null; final int VERS_LENGTH = 3; if (oldVers != null && oldVers.length == VERS_LENGTH && newVers != null && newVers.length == VERS_LENGTH) { try { for (int i = 0; i < VERS_LENGTH; i++) { int over = Integer.parseInt(oldVers[i]); int nver = Integer.parseInt(newVers[i]); if (nver > over) { return true; } else if (nver < over) { return false; } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } return false; } }