Generate repeated String - Android java.lang

Android examples for java.lang:String Algorithm

Description

Generate repeated String

Demo Code

import android.text.TextUtils;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.regex.Pattern;

public class Main{

    public static String repeatedString(String src, int times) {
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < times; ++i) {
            builder.append(src);/*from  w ww . j ava 2  s.c o m*/
        }
        return builder.toString();
    }

}

Related Tutorials