toJavaCSMatrix - R function for converting to sparse matrix