Java - Write code to Fill String by repeating char for certain times

Requirements

Write code to Fill String by repeating char for certain times

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        char val = 'a';
        int len = 42;
        System.out.println(FillString(val, len));
    }//from ww w . ja  v  a  2 s. c o  m

    public static String FillString(char val, int len) {
        String str = "";
        for (int i = 0; i < len; i++)
            str = str + val;
        return str;
    }
}