private static int indexOfSegmentName(String filename){
  int idx=filename.indexOf('_',1);
  if (idx == -1) {
    idx=filename.indexOf('.');
  }
  return idx;
}

private static int indexOfSegmentName ( String filename ) { int idx = filename . indexOf ( '_' , 1 ) ; if ( idx == - 1 ) { idx = filename . indexOf ( '.' ) ; } return idx ; }
locates the boundary of the segment name , or - 1
