通过在前缀和中间添加字符串来修改字符串

I have the implementation as I want to parse the input string 2937029531928S002298 to become like 000293702953-1928S002298 so for this I have written the below code, please advise it is correct or it can be optimized as per java 8 standards more efficiently

  String Id = sRequest.getId(); // i get 2937029531928S002298
  StringBuilder sb = new StringBuilder();
  int prefixString = 000;
  sb.insert(0, Integer.parseInt(String.valueOf(prefixString)));
  sb.append(Id); // 0002937029531928S002298
   sb.insert(13, "-"); //000293702953-1928S002298
评论