this is my java main class in which i m calling the sequence file from another class. So i am able to get any chosen alphabet from randomly arranged alphabets, but I dont know how to get two specified concurrent alphabets like "KG" together. also, how to "get K if not followed by P"- kinda thing.
Kindly provide me the info:


package Molecule;

/**
*
* @author HailKush
*/

class cleavage
{
public void ArgC(String s1)
{
int cnt=0;
String pos="";
for(int i = 0 ; i < s1.length(); i++)
{
char c = s1.charAt(i);
if(c =='r'||c=='R') //change as per the enzyme
{
cnt++;
pos=pos+" "+(i+1);
}
}
System.out.println("Total number of cleavage sites found for Arg-C proteinase : "+cnt);
System.out.println("Positions of the cleavage sites are:"+pos );
}

public void AspN(String s1)
{
int cnt=0;
String pos="";
for(int i = 0 ; i < s1.length(); i++)
{
char c = s1.charAt(i);
if(c =='d'||c=='D') //change as per the enzyme
{
cnt++;
pos=pos+" "+(i);
}
}
System.out.println("Total number of cleavage sites found for Asp-N endopeptidase : "+cnt);
System.out.println("Positions of the cleavage sites are:"+pos );
}


public static void main(String args [] )
{

String s1="";
int cnt=0;
String pos="";
try
{
s1 =Sequence.readFileAsString("C:/seq.txt");// mention the file path where your sequence is kept, it calls from sequence.java file
new cleavage().ArgC(s1);
new cleavage().AspN(s1);

}
catch (Exception e)
{


}
}


}