Java tutorial
//package com.java2s; public class Main { public static short[] parseShortArrayFromHeader(String lineFromHeader) { lineFromHeader = lineFromHeader.replaceAll(",$", ""); lineFromHeader = lineFromHeader.trim(); String[] splitLine = lineFromHeader.split("\\s*,\\s*"); short[] shorts = new short[splitLine.length]; for (int i = 0; i < shorts.length; i++) { shorts[i] = Short.parseShort(splitLine[i]); } return shorts; } }