Java - Write code to get min value from three integers

Requirements

Write code to get min value from three integers

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        int a = 42;
        int b = 2;
        int c = 1;
        System.out.println(min(a, b, c));
    }/*from   ww w . ja  v a  2s.  co m*/

    private static int min(int a, int b, int c) {
        if (b < a) {
            a = b;
        }

        if (c < a) {
            a = c;
        }

        return a;
    }
}

Related Exercise