What will be the output of the following program?
public class FillFromMugsIntoBuckets {
public static int NUMBER_OF_MUGS_PER_BUCKET = 8;
public static int NUMBER_OF_LITERS_PER_MUG = 1.5;
public static void main(String[] args) {
System.out.print(encode(100) + " " + encode(50) + " " + encode(25) + " " + encode(12.5));
}
public static String encode(double size) {
String result = "";
while (size > NUMBER_OF_MUGS_PER_BUCKET * NUMBER_OF_LITERS_PER_MUG) {
result += "B";
size -= NUMBER_OF_MUGS_PER_BUCKET * NUMBER_OF_LITERS_PER_MUG;
}
while (size > NUMBER_OF_LITERS_PER_MUG) {
result += "M";
size -= NUMBER_OF_LITERS_PER_MUG;
}
result += String.format("%1.1f", size);
return result;
}
}