hi all, sorry to bother you with this but i'm trying to find the smallest/largest int in an abstract data type list. what's the proper way to write min/max test - i see so many different ways online.
What I'm thinking is:
int smallest = Integer.MIN_VALUE;
int largest = Integer.MAX_VALUE;
hi, thanks for your reply, the code is very long and complicated. i guess my question should be, how to write a min max code in java? i'm new to java so i'm not sure if there is a standard way to get min max value?
you can focus on solving the min-max problem, so the way to go would be to write a sample program to solve that problem and then integrate with your large problem.
you can explore the List, Collection api. you can create a List of the elements and then sort it. If you sort it in descending order than you can pick the first element for max and the last element for min.