Java while循环中如何去掉末尾数字后的逗号

最后是System.out.print(i++",");
然后输出的结果是1,2,3,4,5,6,7,8,9,10,
怎么去掉10后面的逗号

 System.out.print(i+++(i==10?",":""));