Java tutorial
//package com.java2s; public class Main { /** * generate a dummy repeating String of the specified length */ public static String generateRepeatingStringByLength(String stringtoRepeat, int length) { StringBuilder longStr = new StringBuilder(); while (longStr.length() < length) { longStr.append(stringtoRepeat); } return longStr.substring(0, length); } }