I'm not sure about your first question but I'm sure if you check the documentation for the Math class, and the Double and Float classes you'll find something. As a last resort you can always multiply the number by 100, floor() or round() it to an integer, and then divide by 100.
About the second question:
You should add a variable that tells the loop if it should continue running. Then you write you loop like so:
Code:
while (running) {
// do something
}
Then the input handler just has to set the variable running to false, and the execution of the loop won't continue.
shmoove