FIND THE ANSWERS

Can someone help answer coding bat java string 2 oneTwo please?

Answer this question

Do you know the correct answer? Make money answering questions! Join now.
  • Can someone help answer coding bat java string 2 oneTwo please?


Answers

Anonymous110244 | 07/01 2016 03:20
public String oneTwo(String str) { String temp = ""; String group= ""; if (str.length() < 3) return ""; for (int n = 0; n < str.length()-2; n += 3){ char first = str.charAt(n); temp = str.substring(n + 1,n + 3); group += temp + first; } return group}
Positive: 93 %
Anonymous6664469 | 07/01 2016 03:14
i hope this help you in someway :D public String oneTwo(String str) { String temp = ""; String group= ""; if (str.length() < 3) return ""; String m = str.substring(1,3); for (int n = 0; n < str.length()-2; n += 3){ char first = str.charAt(n); if(str.length() == 3){ temp = str.substring(1,3); group += temp + first; break; } temp = str.substring(n + 1,n + 3); group += temp + first; } return group; }
Positive: 87 %
Anonymous71933
Login to your account
Create new account