Skip to content

Instantly share code, notes, and snippets.

@pavelnganpi
Created July 18, 2014 14:37
Show Gist options
  • Save pavelnganpi/cee2dd77ebbd3af5e1c1 to your computer and use it in GitHub Desktop.
Save pavelnganpi/cee2dd77ebbd3af5e1c1 to your computer and use it in GitHub Desktop.
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);
}
}
@satveersm
Copy link

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........

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment