Also, here’s a little tip:
Arrays in Java can be declared in a shorter syntax:
// so instead of this
float[] longest = new float[2];
longest[0] = 1;
longest[1] = 2;
// do this for arrays in method arguments
new float[] { 1, 2 }
// or this for initializing an array
float[] shortest = { 1, 2 };