Here you can find the source of multiply(String self, int reps)
static public String multiply(String self, int reps)
//package com.java2s; /*/* w ww . jav a 2s . c om*/ The contents of this file are subject to the Electric Communities E Open Source Code License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.communities.com/EL/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is the Distributed E Language Implementation, released July 20, 1998. The Initial Developer of the Original Code is Electric Communities. Copyright (C) 1998 Electric Communities. All Rights Reserved. Contributor(s): ______________________________________. */ public class Main { /** * reps repitions of self */ static public String multiply(String self, int reps) { StringBuffer buf = new StringBuffer(self.length() * reps); for (int i = 0; i < reps; i++) { buf.append(self); } return buf.toString(); } }