repeatEnd: n copies of the last n letters
Given a string and an int n, return a string made of n repetitions of the last n characters. Step through repeatEnd: it cuts the end off once with substring(str.length()-n), then the loop just adds that same piece n times. (CodingBat promises n is between 0 and the length of the string.)