program in array to remove zeroes from a digit | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

program in array to remove zeroes from a digit

ex.5400207 o/p::: 5427

9th Oct 2017, 2:50 PM
Apoorv kumar
Apoorv kumar - avatar
1 Answer
+ 3
1. Convert integer to string using method String.valueOf( int) which will return a string value 2. Implement method replaceAll(“0”,””) which means replace all zeros with empty string 3. Now parse string value to integer using method Integer.parseInt(string) which will return a integer value Basically you are just using a replaceAll(“0”,””) to find the 0's and replace them with nothing. You just need to put this out as a string first.
9th Oct 2017, 3:44 PM
ihateonions