public void acquireProbabilities(final String string){
  if (string.length() < 2) {
    return;
  }
  for (int i=2; i < string.length(); ++i) {
    final char previousChar=string.charAt(i - 2);
    final char currentChar=string.charAt(i - 1);
    final char nextChar=string.charAt(i);
    final String key=previousChar + "" + currentChar;
    if (!sequences.contains(key)) {
      sequences.add(key);
    }
    HashMap<Character,Integer> probabilities=sequenceProbabilities.get(key);
    if (probabilities == null) {
      probabilities=new HashMap<>();
      sequenceProbabilities.put(key,probabilities);
    }
    int existingValue=probabilities.getOrDefault(nextChar,0);
    ++existingValue;
    probabilities.put(nextChar,existingValue);
  }
}

public void acquireProbabilities ( final String string ) { if ( string . length ( ) < 2 ) { return ; } for ( int i = 2 ; i < string . length ( ) ; ++ i ) { final char previousChar = string . charAt ( i - 2 ) ; final char currentChar = string . charAt ( i - 1 ) ; final char nextChar = string . charAt ( i ) ; final String key = previousChar + "" + currentChar ; if ( ! sequences . contains ( key ) ) { sequences . add ( key ) ; } HashMap < Character , Integer > probabilities = sequenceProbabilities . get ( key ) ; if ( probabilities == null ) { probabilities = new HashMap < > ( ) ; sequenceProbabilities . put ( key , probabilities ) ; } int existingValue = probabilities . getOrDefault ( nextChar , 0 ) ; ++ existingValue ; probabilities . put ( nextChar , existingValue ) ; } }
parses the specified string to determine the probability of a character appearing after the previous two characters beginning with the third character in the string and ending with the last .
