Java Array Max Value max(Long john, Long... jane)

Here you can find the source of max(Long john, Long... jane)

Description

Replaces null with 0l

License

Apache License

Parameter

Parameter Description
john a parameter

Return

long

Declaration

public static long max(Long john, Long... jane) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*ww  w.  j  av a  2 s  .c  o m*/
     * Replaces null with 0l
     * 
     * @param john
     * @return long
     */
    public static long max(Long john, Long... jane) {
        if (jane == null) {
            throw new IllegalArgumentException("jane == null");
        }

        long jill = checkNull(john);

        for (Long jack : jane) {
            jill = Math.max(checkNull(jack), jill);
        }

        return jill;
    }

    /**
     * Replaces null with 0l
     * 
     * @param john
     * @return long
     */
    public static String checkNull(String bean) {
        return bean == null ? "" : bean;
    }

    /**
     * Replaces null with 0l
     * 
     * @param john
     * @return long
     */
    public static long checkNull(Long john) {
        return john == null ? 0l : john.longValue();
    }
}

Related

  1. max(int[] values)
  2. max(int[] values)
  3. max(int[] values)
  4. max(int[] vs)
  5. max(int[] x, int length)
  6. max(long[] array)
  7. max(long[] array)
  8. max(long[] array)
  9. max(Number... array)