This is not really a Java question, it is more of a scientific programming question.
You will need to start by writing down the equation for the Entropy balance for your system.
If the balance depends on time, or other state derivatives, you will probably need a initial value ode solver. They are not hard to write, just substitute a small delta t for dt in the equations. Or, do a google on initial value ode java. Runge Kutta is a typical initial value ode solution algorithm.
If the balance does not depend on time, or other state derivatives, then you have to just solve the equation for Entropy. And then program the resulting equation.
Here is a link to a java entropy solution
Java Entropy Solution
And, here is a link that defines entropy, to help you write down the equations for your system.
Entropy Equations
John