Java Number Percentage Format getPercent(long val1, long val2)

Here you can find the source of getPercent(long val1, long val2)

Description

get Percent

License

Open Source License

Declaration

private static String getPercent(long val1, long val2) 

Method Source Code

//package com.java2s;
/*//  ww  w.j  a  v  a2 s . c  o m
 * Copyright (C) 2010 Bernardo O. Bennett
 * 
 * This file is part of Pipe4j.
 * 
 * Pipe4j is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option) any
 * later version.
 * 
 * Pipe4j is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the Lesser GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the Lesser GNU General Public License
 * along with Pipe4j. If not, see <http://www.gnu.org/licenses/>.
 */

import java.text.NumberFormat;

public class Main {
    private static final NumberFormat NF = NumberFormat.getPercentInstance();

    private static String getPercent(long val1, long val2) {
        return NF.format((double) val1 / val2);
    }
}

Related

  1. getPercent(Double num)
  2. getPercent(double percent)
  3. getPercent(Double value)
  4. getPercent(final long downloadCurrent, final long downloadMax)
  5. getPercent(long l1, long l2)
  6. getPercentFormatter()
  7. getPercentileWithSuffix(double percentile)
  8. getPercentileWithSuffix(double percentile)
  9. getPercentMemUse()