Program: 169220
Project: 169220
Buggy source:
private final static int[] computeNgramMinHashesWeighted(String seq,final int nGramSize,final int numHashes,FrequencyCounts kmerFilter,boolean weighted){
  final int numberNGrams=seq.length() - nGramSize + 1;
  if (numberNGrams < 1)   throw new SketchRuntimeException("String_Node_Str");
  final long[] kmerHashes=HashUtils.computeSequenceHashesLong(seq,nGramSize,0);
  HashMap<Long,HitCounter> hitMap=new LinkedHashMap<>(kmerHashes.length);
  int maxCount=0;
  for (  long kmer : kmerHashes) {
    HitCounter counter=hitMap.get(kmer);
    if (counter == null) {
      counter=new HitCounter(1);
      hitMap.put(kmer,counter);
    }
 else     counter.addHit();
    if (maxCount < counter.count)     maxCount=counter.count;
  }
  int[] hashes=new int[Math.max(1,numHashes)];
  long[] best=new long[numHashes];
  Arrays.fill(best,Long.MAX_VALUE);
  for (  Entry<Long,HitCounter> kmer : hitMap.entrySet()) {
    long key=kmer.getKey();
    int weight=kmer.getValue().count;
    if (!weighted)     weight=1;
    if (kmerFilter != null) {
      if (weighted) {
        weight=(int)kmerFilter.idfDiscrete(key,3);
      }
 else {
        if (kmerFilter.contains(key))         weight=0;
      }
    }
    if (weight <= 0)     continue;
    long x=key;
    for (int word=0; word < numHashes; word++) {
      for (int count=0; count < weight; count++) {
        x^=(x << 21);
        x^=(x >>> 35);
        x^=(x << 4);
        if (x < best[word]) {
          best[word]=x;
          if (word % 2 == 0)           hashes[word]=(int)key;
 else           hashes[word]=(int)(key >>> 32);
        }
      }
    }
  }
  return hashes;
}

Fixed version (ground truth):
private final static int[] computeNgramMinHashesWeighted(String seq,final int nGramSize,final int numHashes,FrequencyCounts kmerFilter,boolean weighted){
  final int numberNGrams=seq.length() - nGramSize + 1;
  if (numberNGrams < 1)   throw new SketchRuntimeException("String_Node_Str");
  final long[] kmerHashes=HashUtils.computeSequenceHashesLong(seq,nGramSize,0);
  HashMap<Long,HitCounter> hitMap=new LinkedHashMap<>(kmerHashes.length);
  int maxCount=0;
  for (  long kmer : kmerHashes) {
    HitCounter counter=hitMap.get(kmer);
    if (counter == null) {
      counter=new HitCounter(1);
      hitMap.put(kmer,counter);
    }
 else     counter.addHit();
    if (maxCount < counter.count)     maxCount=counter.count;
  }
  int[] hashes=new int[Math.max(1,numHashes)];
  long[] best=new long[numHashes];
  Arrays.fill(best,Long.MAX_VALUE);
  for (  Entry<Long,HitCounter> kmer : hitMap.entrySet()) {
    long key=kmer.getKey();
    int weight=kmer.getValue().count;
    if (!weighted)     weight=1;
    if (kmerFilter != null) {
      if (weighted) {
        weight=(int)(((double)weight) * kmerFilter.idfDiscrete(key,3));
        if (weight < 1)         weight=1;
      }
 else {
        if (kmerFilter.contains(key))         weight=0;
      }
    }
    if (weight <= 0)     continue;
    long x=key;
    for (int word=0; word < numHashes; word++) {
      for (int count=0; count < weight; count++) {
        x^=(x << 21);
        x^=(x >>> 35);
        x^=(x << 4);
        if (x < best[word]) {
          best[word]=x;
          if (word % 2 == 0)           hashes[word]=(int)key;
 else           hashes[word]=(int)(key >>> 32);
        }
      }
    }
  }
  return hashes;
}