Java - Write code to format double value to percentage

Requirements

Write code to format double value to percentage

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        double percent = 42.45678;
        System.out.println(percent2str(percent));
    }/*from   ww w  .  j a  v a  2 s . c o m*/

    public static String percent2str(double percent) {
        int percentInt = (int) (percent * 100);
        return percentInt + "%";
    }
}