Prepare a full java program to solve the following problem:
Read in a sum of money and determine the number of quarters, dimes, pennies and nickels represented in the cents portion. You must get an optimal mix; all pennies, for example, is not allowed.
Solve this problem using java programming concepts.