Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class Test {
- public void main() {
- ArrayList<Double> arrayList = new ArrayList<>();
- arrayList.add(1.22);
- arrayList.add(2.3333);
- arrayList.add(4.3453);
- arrayList.add(-13.45);
- Double minValue = Double.MAX_VALUE;
- Double maxValue = Double.MIN_VALUE;
- for (Double element : arrayList) {
- if (Double.compare(element, minValue) < 0) {
- minValue = element;
- }
- if (Double.compare(element, maxValue) > 0) {
- maxValue = element;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement