Java tutorial
//package com.java2s; public class Main { public static String getRatingFromString(String valueofRating) { String rate = valueofRating.toLowerCase(); if ("red".equals(rate)) { return "1"; } if ("green".equals(rate)) { return "3"; } if ("yellow".equals(rate)) { return "2"; } return "0"; } }