Add pizza problem in java