Java - Write code to Create string out of byte array with UTF-8

Requirements

Write code to Create string out of byte array with UTF-8

Demo

import java.io.UnsupportedEncodingException;

public class Main{
    public static void main(String[] argv){
        byte[] bytes = new byte[]{34,35,36,37,37,37,67,68,69};
        System.out.println(byte2str(bytes));
    }// www . j  a  v  a2 s.co m
    public static String byte2str(byte[] bytes)
            throws UnsupportedEncodingException {
        return new String(bytes, "UTF-8");
    }
}