public static String getPercentage(long numerator, long denominator) {

    if (denominator == 0) {
      return "NaN";
    }

    double percentage = ((double) numerator / (double) denominator) * 100;

    if ((long) (percentage) == 0) {
      return "0 %";
    }

    DecimalFormat df = new DecimalFormat("0.00");
    return df.format(percentage).concat(" %");
  }
Find percentage of numerator of denominator
@param numerator The numerator
@param denominator The denominator
@return The percentage string of the form `x.yz %`
app/com/linkedin/drelephant/util/Utils.java