# How to calculate mutual index of concidence of two strings Java

i am trying to calculate the mutual index of concidence of two strings, A and B. I have calculated the frequency of each letter in each string. However, i do not know how to continue from there. Any help is appreciated. The expected output is supposed to be some decimal value. Thanks!

``````public class MutualIndexOfAB
{
public double calculateMutual(String a, String b)
{
int i, j;
int NA = 0;
int NB = 0;
double sum = 0.0, total = 0.0;
a = a.toUpperCase();
b = b.toUpperCase();

// calculate frequency of each letter in String a
int chA;
for (i=0; i<a.length(); i++)
{
ch = a.charAt(i)-65;
if (chA>=0 && chA <26)
{
values[chA]++;
NA++;
}
}

// calculate frequency of each letter in String b
int chB;
for (j=0; j<b.length(); j++)
{
chB = b.charAt(j)-65;
if (chB>=0 && chB <26)
{
values[chB]++;
NB++;
}
}

}

public static void main(String[] args)
{
MutualIndexOfAB test = new MutualIndexOfAB();

String textA = "cyber security is about how we develop secure computers and computer networks, to ensure that the data stored and transmitted through them is protected from unauthorized access or to combat digital security threats and hazards. as we conduct more of our social, consumer and business activities online, there is a corresponding increase in the demand for ict professionals to manage our digital environment and economy.";

String textB = "cyber security has been identified as one of the strategic priorities in australia to meet the demands of law enforcement, national and state governments, defense, security and finance industries. jobs of the future will be in all of these areas ensuring there is national capability to maintain and build our essential services and stop them from being disrupted, destroyed, or threatened, and that our personal information is not communicated, shared, visualized or analysed without our permission.";

System.out.println("Mutual Index of Concidence of Texts A and B: " + test.calculateMutual(textA, textB));
}
``````

}