Created
July 18, 2014 14:37
-
-
Save pavelnganpi/cee2dd77ebbd3af5e1c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
public class StringToInt { | |
public static String IntToString( int num ){ | |
int rem = 0; | |
int div = 0; | |
StringBuilder sb = new StringBuilder(); | |
while(num !=0){ | |
rem = num%10; | |
sb.append(rem); | |
num = num/10; | |
} | |
return sb.reverse().toString(); | |
} | |
public static void main(String[]args){ | |
int n = 123; | |
String noi = strToInt(n); | |
System.out.println(noi); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oh u done it .... but u not handled case of negative no and one more thing i wana say u used reverse this i not want can u do without using reverse logic........