I have below method used to drop same characters in String, Anyone
help and guide me how to optimize a program run as fast as possible ,
thanks a lot
Here method's code :

public String DropSameCharactersInString()

{

System.out.println("Orginal String : aebtetdt");

String tmp = "aebtetdta";

int len = tmp.length();

char [] a = tmp.toCharArray();

char [] c = new char [len];

String result = "";

boolean f = false;

for(int i = 0; i < len - 1; i++)

{

for(int x = i 1; x < len; x+)

{

if(tmp.charAt(i) == tmp.charAt(x))

{

c[i] = tmp.charAt(i);

result = result tmp.charAt(i);

}



}

}

System.out.print("Result " result);

return result;

}

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to