Format float value to Percent String - Android java.lang

Android examples for java.lang:Double

Description

Format float value to Percent String

Demo Code

import android.text.TextUtils;
import java.util.Locale;
import java.util.UUID;

public class Main{

    public static String getPercentString(float percent) {
        return String.format(Locale.US, "%d%%", (int) (percent * 100));
    }//from   w w w  .j  a v  a  2s. c o m

}

Related Tutorials