Java tutorial
//package com.java2s; public class Main { public static int whichType(String str) { String[] sourceStrArray = str.split(",,"); String firstStr = sourceStrArray[0]; if (sourceStrArray.length < 4) return 1; else if (sourceStrArray.length > 3 && ",C01".equalsIgnoreCase(firstStr)) return 2; else if (sourceStrArray.length > 3 && !",C01".equalsIgnoreCase(firstStr)) return 0; else return -1; } }