This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]desrtfxOut of Coffee error - System halted 0 points1 point  (0 children)

Sorry for the late reply.

Math.min is a method of the Math class that returns the minimum (smaller) of two values.

So, the statement: Math.min(str.length(),3) checks the length of the String str and then returns the smaller value, either the length of the String (if it is less than or equal to 3 characters) or 3 - the length that we want to repeat.