Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Expands a string s to have the length l
- * @param s the String to expand
- * @param l the length of the desired String
- * @return s, copied until it has length l
- */
- public static String expand(String s, int l) {
- String ret = new String(s);
- while(ret.length() < l) {
- ret += ret;
- }
- if(ret.length() > l) {
- ret = ret.substring(0, l);
- }
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement