This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes How to determine min of two int values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to determine min of two int values" Watch "How to determine min of two int values" New topic
Author

How to determine min of two int values

Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 386

Is there a way to determine the min value between two int values?

I have two recordsets that I am getting the row count of each recordset:

int rsRowCount = rs.getRowCount();

int rs1RowCount = rs1.getRowCount();

I need to get the value of the rowcount that is determined to be the min value between the two.

Any help or direction would be greatly appreciated.

Regards.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3482
    
  13
Have you had a look at the Math class to see if there might be anything useful in there ?


Joanne
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 386

No I have not. Thanks for the direction.

Regards.
seema prakash
Ranch Hand

Joined: Nov 17, 2004
Posts: 59
int minRowCount = Math.min(rsRowCount,rs1RowCount);
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 386

Joanne -- thanks so much I got it.

Seema - thanks anyway. Your reply is appreciated.

Regards.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to determine min of two int values