public static String keyAlgorithm(String algorithm){
  int index=algorithm.indexOf('_');
  if (index == -1) {
    return algorithm;
  }
  return algorithm.substring(0,index);
}

public static String keyAlgorithm ( String algorithm ) { int index = algorithm . indexOf ( '_' ) ; if ( index == - 1 ) { return algorithm ; } return algorithm . substring ( 0 , index ) ; }
return the key algorithm for a possible compound algorithm identifier containing an underscore . if not underscore is present , the argument is returned unmodified . however for an algorithm such as ec_rsa , return ec .
