Skip to content

Instantly share code, notes, and snippets.

@marawannwh
Created December 15, 2012 15:06
Show Gist options
  • Save marawannwh/4296124 to your computer and use it in GitHub Desktop.
Save marawannwh/4296124 to your computer and use it in GitHub Desktop.
public class IpCutter{
public static void main(String[] args){
int x;
int begin;
int end;
int count;
String ip;
x=0;
begin=0;
end=1;
count=1;
while(count>0){
end=args[0].indexOf('.',begin);
if(end<x){
ip=args[0].substring(begin);
System.out.println(ip);
count=0;
}
else if(end>x){
ip=args[0].substring(begin,end);
System.out.println(ip);}
else if(end==x){
ip=args[0].substring(begin);
System.out.println(ip);
count=0;
}
x=end;
begin=end+1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment