Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
1 -- change to 4
4 -- change to 9
9 -- change to 25
16 -- change to 10000
25 -- change to 49
36 -- change to 9
49 -- change to 25
64 -- change to 9
81 -- change to 1
100 -- change to 16

What I have tried:

System.out.println(Numbers.toString().trim().replaceAll(",","").replaceAll(" ", "\n").replace("[","").replace("]", "").replace("1", "4"));

but everytime i change 1 all number have a 1 it all change to 4 lol any answer and suggestion?
Posted
Comments
Richard MacCutchan 13-Oct-21 11:40am    
Why are you converting an array to a string? Also complex statements like that are almost impossible to debug. Write your code one step at a time so you can actually see what is happening at each step. You need to show the actual code where the array is created and explain what you are trying to do.
Marvin Añasco 13-Oct-21 11:52am    
all number that i store in arraylist are String<> that's whay i use toString, even if i store Integer it is they same answer like arraylist
Richard MacCutchan 13-Oct-21 11:56am    
That does not make sense; if all the numbers are strings, why are you calling toString on them? And as I said, you need to show the actual array and the code that initialises it, as well as a better explanation of what you are trying to achieve.
Marvin Añasco 13-Oct-21 12:04pm    
ok got it , but w8 can u give some hint regarding with this problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900