Program: 31777
Project: 31777
Buggy source:
void init(int _nFreq,int _nTime,ScreenPhysicalMapping _axis){
  if (_nFreq == 0 || _nTime == 0 || Math.max(_axis.vLowerBound,_axis.vUpperBound) == 0) {
    return;
  }
  bmpWidth=(int)(_nFreq * incFactor * interpolationFactor);
  if (bm.length != bmpWidth * _nTime) {
    bm=new int[bmpWidth * _nTime];
    bmShiftCache=new int[bm.length];
  }
  if (nFreq != _nFreq || nTime != _nTime) {
    clear();
  }
  nFreq=_nFreq;
  nTime=_nTime;
  double maxFreq=Math.max(_axis.vLowerBound,_axis.vUpperBound);
  double minFreq=maxFreq / nFreq;
  double dFreq=maxFreq / nFreq;
  int nSegment=(int)(Math.log((maxFreq + 0.1) / minFreq) / Math.log(incFactor)) + 1;
  Log.d(TAG,"String_Node_Str" + nFreq + "String_Node_Str"+ dFreq+ "String_Node_Str"+ nSegment+ "String_Node_Str"+ bmpWidth);
  pixelAbscissa=new double[nSegment + 1];
  freqAbscissa=new double[nSegment + 1];
  pixelAbscissa[0]=0;
  freqAbscissa[0]=minFreq;
  Log.v(TAG,"String_Node_Str" + 0 + "String_Node_Str"+ pixelAbscissa[0]);
  for (int i=1; i <= nSegment; i++) {
    pixelAbscissa[i]=(pow(maxFreq / minFreq,(double)i / nSegment) * minFreq - minFreq) / (maxFreq - minFreq);
    pixelAbscissa[i]=Math.floor(pixelAbscissa[i] * bmpWidth);
    freqAbscissa[i]=pixelAbscissa[i] / bmpWidth * (maxFreq - minFreq) + minFreq;
    Log.v(TAG,"String_Node_Str" + i + "String_Node_Str"+ pixelAbscissa[i]+ "String_Node_Str"+ freqAbscissa[i]);
  }
  iFreqToPix=new double[nFreq + 1];
  iFreqToPix[0]=0;
  double eps=1e-7;
  int iF=1;
  ScreenPhysicalMapping axisSeg=new ScreenPhysicalMapping(1.0f,(float)minFreq,(float)maxFreq,ScreenPhysicalMapping.Type.LOG);
  for (int i=1; i <= nSegment; i++) {
    axisSeg.setNCanvasPixel((float)Math.round(pixelAbscissa[i] - pixelAbscissa[i - 1]));
    axisSeg.setBounds((float)freqAbscissa[i - 1],(float)freqAbscissa[i]);
    Log.v(TAG,"String_Node_Str" + i + "String_Node_Str"+ axisSeg.nCanvasPixel+ "String_Node_Str"+ axisSeg.vLowerBound+ "String_Node_Str"+ axisSeg.vUpperBound);
    while ((iF + 0.5) * dFreq <= freqAbscissa[i] + eps) {
      iFreqToPix[iF]=axisSeg.pixelFromV((float)((iF + 0.5) * dFreq)) + pixelAbscissa[i - 1];
      iF++;
    }
  }
  if (iF < nFreq) {
    iFreqToPix[nFreq]=pixelAbscissa[nSegment];
  }
}

Fixed version (ground truth):
void init(int _nFreq,int _nTime,ScreenPhysicalMapping _axis){
  if (_nFreq == 0 || _nTime == 0 || Math.max(_axis.vLowerBound,_axis.vUpperBound) == 0) {
    return;
  }
  bmpWidth=(int)(_nFreq * incFactor * interpolationFactor);
  if (bm.length != bmpWidth * _nTime) {
    bm=new int[bmpWidth * _nTime];
    bmShiftCache=new int[bm.length];
  }
  if (nFreq != _nFreq || nTime != _nTime) {
    clear();
  }
  nFreq=_nFreq;
  nTime=_nTime;
  double maxFreq=Math.max(_axis.vLowerBound,_axis.vUpperBound);
  double minFreq=maxFreq / nFreq;
  double dFreq=maxFreq / nFreq;
  int nSegment=(int)(Math.log((maxFreq + 0.1) / minFreq) / Math.log(incFactor)) + 1;
  Log.d(TAG,"String_Node_Str" + nFreq + "String_Node_Str"+ dFreq+ "String_Node_Str"+ nSegment+ "String_Node_Str"+ bmpWidth);
  pixelAbscissa=new double[nSegment + 1];
  freqAbscissa=new double[nSegment + 1];
  pixelAbscissa[0]=0;
  freqAbscissa[0]=minFreq;
  Log.v(TAG,"String_Node_Str" + 0 + "String_Node_Str"+ pixelAbscissa[0]);
  for (int i=1; i <= nSegment; i++) {
    pixelAbscissa[i]=(pow(maxFreq / minFreq,(double)i / nSegment) * minFreq - minFreq) / (maxFreq - minFreq);
    pixelAbscissa[i]=Math.floor(pixelAbscissa[i] * bmpWidth);
    freqAbscissa[i]=pixelAbscissa[i] / bmpWidth * (maxFreq - minFreq) + minFreq;
    Log.v(TAG,"String_Node_Str" + i + "String_Node_Str"+ pixelAbscissa[i]+ "String_Node_Str"+ freqAbscissa[i]);
  }
  iFreqToPix=new double[nFreq + 1];
  iFreqToPix[0]=0;
  double eps=1e-7;
  int iF=1;
  ScreenPhysicalMapping axisSeg=new ScreenPhysicalMapping(1.0,minFreq,maxFreq,ScreenPhysicalMapping.Type.LOG);
  for (int i=1; i <= nSegment; i++) {
    axisSeg.setNCanvasPixel(Math.round(pixelAbscissa[i] - pixelAbscissa[i - 1]));
    axisSeg.setBounds(freqAbscissa[i - 1],freqAbscissa[i]);
    Log.v(TAG,"String_Node_Str" + i + "String_Node_Str"+ axisSeg.nCanvasPixel+ "String_Node_Str"+ axisSeg.vLowerBound+ "String_Node_Str"+ axisSeg.vUpperBound);
    while ((iF + 0.5) * dFreq <= freqAbscissa[i] + eps) {
      iFreqToPix[iF]=axisSeg.pixelFromV((iF + 0.5) * dFreq) + pixelAbscissa[i - 1];
      iF++;
    }
  }
  if (iF < nFreq) {
    iFreqToPix[nFreq]=pixelAbscissa[nSegment];
  }
}