private Long updateLongWithMax(Long previousValue,Long newValue){
  if (newValue == null) {
    return previousValue;
  }
  if (newValue < 0) {
    return 0L;
  }
  return Math.max(previousValue,newValue);
}

private Long updateLongWithMax ( Long previousValue , Long newValue ) { if ( newValue == null ) { return previousValue ; } if ( newValue < 0 ) { return 0L ; } return Math . max ( previousValue , newValue ) ; }
update long value . check for null and overflow .
