kiran
kiran

Reputation: 1

to pass values (data) from our application to native app in android?

i am developing program for union and intersection of two strings in android, i also calculate number of character in union as well intersect results individually?the results values (union&intersect) should pass to native calculator and the result will shown in calculator?

i have to pass the that result data to native calculator?

examle:i have two strings

sunday, monday

the union is:sundaymo,the length of result union string is:8 the intersection is :nday,the length of result intersection string is:4

the sum of union and intersection is :8+4=12; the values 8 and 4 should pass to native calculator,the result should be shown in native calculator.

how should i do please provide code for me please answer to me

Upvotes: 0

Views: 121

Answers (1)

Kushan
Kushan

Reputation: 10695

String s1 = new String("10201");
String s2 = new String("01341");


//intersect
HashSet<Character> h1 = new HashSet<Character>(), h2 = new HashSet<Character>();
for(int i = 0; i < s1.length(); i++)                                            
{
    h1.add(s1.charAt(i));
}
for(int i = 0; i < s2.length(); i++)
{
    h2.add(s2.charAt(i));
}

//union
h1.addAll(h2);

//intersect
h1.retainAll(h2);


//

Upvotes: 1

Related Questions