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));
    }/*w w w .  j  a va  2 s.  c  om*/

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