public static void main(String[] args) {
    BufferedReader br;
    String fromUnit = null;
    String toUnit = null;
    double value = 0;

    //  prompt the user to enter unit to convert from
    System.out.print("Convert from: ");
    //  open up standard input
    br = new BufferedReader(new InputStreamReader(System.in));
    try {
      fromUnit = br.readLine();
    } catch (IOException ioe) {
      System.exit(1);
    }
    // prompt user to enter unit to convert to
    System.out.print("Convert to: ");
    br = new BufferedReader(new InputStreamReader(System.in));
    try {
      toUnit = br.readLine();
    } catch (IOException ioe) {
      System.exit(1);
    }

    // create new UnitConvert objects
    UnitConverter from = new UnitConverter(fromUnit);
    UnitConverter to = new UnitConverter(toUnit);

    // prompt user to enter initial value to convert
    System.out.print("Value: ");
    br = new BufferedReader(new InputStreamReader(System.in));
    try {
      value = Double.parseDouble(br.readLine());
    } catch (IOException ioe) {
      System.exit(1);
    }

    double metric = from.toMetric(value);
    double converted = to.fromMetric(metric);

    if (converted < 0) {
      System.out.println("ERROR: Bad Input");
    } else {
      System.out.println(value + " " + fromUnit + " = " + converted + " " + toUnit);
    }
  }
  public double Convert(String from, String to, double input) {
    // TODO Auto-generated method stub

    if ((from.equals(
            UnitConverter.getInstance()
                .getApplicationContext()
                .getResources()
                .getString(R.string.temperatureunitc))
        && to.equals(
            (UnitConverter.getInstance()
                .getApplicationContext()
                .getResources()
                .getString(R.string.temperatureunitf))))) {
      double ret = (double) ((input * 9 / 5) + 32);
      return ret;
    }

    if ((from.equals(
            UnitConverter.getInstance()
                .getApplicationContext()
                .getResources()
                .getString(R.string.temperatureunitf))
        && to.equals(
            (UnitConverter.getInstance()
                .getApplicationContext()
                .getResources()
                .getString(R.string.temperatureunitc))))) {
      double ret = (double) ((input - 32) * 5 / 9);
      return ret;
    }

    if (from.equals(to)) {
      return input;
    }
    return 0.0;
  }