Jun 14

How to add two BigDecimal values in java?

This program demonstrates how to add two big decimal numbers in java.

Method : public BigDecimal add(BigDecimal augend):

Number of arguments : 1

Return value : BigDecimal

[code lang=”java”]import java.math.BigDecimal;

public class BigDecimalAddDemo {

public static void main(String[] args) {

BigDecimal bigDecimal3;

BigDecimal bigDecimal1=new BigDecimal(123.3256);

BigDecimal bigDecimal2=new BigDecimal(345.768);






May 07

How to convert lowercase letters to uppercase and viceversa in java?

Converting UpperCase letters to lowercase and  converting lowercase Letters to uppercase in java

To convert letters in uppercase to lowercase and viceversa we have a method in Stringutils class called swapcase which does this.

Ex: StringUtils.swapCase(“java-interview-questions”); returns


Syntax : public static String swapCase(final String str) ;

SwapCase accepts String as argument and returns String after conversion. Continue reading