NGramJ

From their website:

NGramJ is a Java based library containing two types of ngram based applications. It’s major focus is to provide robust and state of the art language recognition (or language guessing how some call it more correctly).

Open source software under the LGPL.