Java Number Power pow(String str, int n)

Here you can find the source of pow(String str, int n)

Description

Power-function in the free Monoid over Characters (AKA "Strings").

License

Open Source License

Parameter

Parameter Description
str the String to repeat.
n how often the string is repeated.

Return

tge resulting string.

Declaration

public static String pow(String str, int n) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from   w  w w. j av a2s .c  o  m
     * Power-function in the free Monoid over Characters (AKA "Strings").
     * 
     * @param str the String to repeat.
     * @param n how often the string is repeated.
     * @return tge resulting string.
     */
    public static String pow(String str, int n) {
        StringBuilder b = new StringBuilder();
        for (int i = 0; i < n; i++) {
            b.append(str);
        }
        return b.toString();
    }
}

Related

  1. pow(Integer a, Integer b)
  2. pow(long base, long exp)
  3. pow(long n, long pow)
  4. pow(long value, long pow)
  5. pow(Number x, Number exponent)
  6. pow10(final int exponent)
  7. pow10(int degree)
  8. pow10(int n)
  9. pow16(float a)