Capgemini interview question

java code of array or string