How to convert BigInteger to String in java

前端 未结 9 1646
眼角桃花
眼角桃花 2020-12-24 13:39

I converted a String to BigInteger as follows:

Scanner sc=new Scanner(System.in);
System.out.println(\"enter the message\");
String         


        
9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-24 13:56

    //How to solve BigDecimal & BigInteger and return a String.

      BigDecimal x = new BigDecimal( a );
      BigDecimal y = new BigDecimal( b ); 
      BigDecimal result = BigDecimal.ZERO;
      BigDecimal result = x.add(y);
      return String.valueOf(result); 
    

提交回复
热议问题