Java - Write code to convert int to String

Requirements

Write code to convert int to String

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        int num = 42;
        System.out.println(int2String(num));
    }//  w  w  w.java 2  s  .com

    public static String int2String(int num) {
        try {
            String str = String.valueOf(num);
            return str;
        } catch (Exception e) {
            return "";
        }
    }
}