Java tutorial
//package com.java2s; public class Main { public static String parseCookie(String rawCookie) { int indexStart = rawCookie.indexOf("JSESSIONID="); if (indexStart >= 0) { int indexStop = rawCookie.indexOf(";", indexStart); if (indexStop >= 0 && indexStop > indexStart) { return rawCookie.substring(indexStart, indexStop); } } return ""; } }