import java.text.SimpleDateFormat;
import java.util.Date;

public class GlobalMethodCall
{
  public static String getAge(String dob)
  {
    String val = "";
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    try {
      Date date = formatter.parse(dob);
      Date currentDate = new Date();
      long timeDiff = currentDate.getTime() - date.getTime();
      long hours = timeDiff / 3600000L;
      long years = hours / 8760L;
      val = years;
    } catch (Exception e) {
      e.printStackTrace();
    }
    return val;
  }

  public static String getDaysLeft(String exp) {
    String val = "";
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    try {
      Date date = formatter.parse(exp);
      Date currentDate = new Date();

      if (currentDate.before(date)) {
        val = "0"; break label54:
      }
      val = "-1";
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    label54: return val;
  }

  public static String getAccountType(String str)
  {
    if (str.indexOf("-") != -1)
    {
      String[] splitStr = str.split("-");
      String strBefore = splitStr[0].toUpperCase();
      String strAfter = splitStr[1];
      boolean isNumericBefore = false;
      boolean isNumericAfter = false;
      boolean isAlphabetBefore = false;

      isNumericBefore = strBefore.matches("[0-9]+");
      isNumericAfter = strAfter.matches("[0-9]+");
      isAlphabetBefore = strBefore.matches("[A-Z]+");
      if ((isNumericBefore) && (isNumericAfter))
      {
        return "NumericNumeric"; }
      if ((isAlphabetBefore) && (isNumericAfter))
        return "AlphabetNumeric";

      return "ErrorData";
    }

    return "ErrorData";
  }
}