public static int getPercentage ( String percentage ) { if ( isNotEmpty ( percentage ) && isNumeric ( percentage ) ) { int p = Integer . parseInt ( percentage ) ; return p ; } else { return 0 ; } }
Takes a numeric string value and converts it to a integer between 0 and 100 .