Fix a warning and bug

Use Locale.ROOT for toLowerCase() to silence android warning
Use sampleHistory.length which is 2048 long, not the other
which is only overlap long...