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));
    }// w  w w . j  a v  a  2s  .co m

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