Java tutorial
//package com.java2s; public class Main { public static int nullAsNil(Integer integer) { int i; if (integer == null) i = 0; else i = integer.intValue(); return i; } public static long nullAsNil(Long long1) { long l; if (long1 == null) l = 0L; else l = long1.longValue(); return l; } public static String nullAsNil(String s) { if (s == null) s = ""; return s; } }