We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Comparator<String>myComparator=(s1,s2)->{if(s1==null&&s2==null)return0;if(s1==null)return1;// Push nulls to the endif(s2==null)return-1;// Push nulls to the endBigDecimalbd1=newBigDecimal(s1);BigDecimalbd2=newBigDecimal(s2);returnbd2.compareTo(bd1);// Sort in descending order based on numeric value};Arrays.sort(s,myComparator);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java BigDecimal
You are viewing a single comment's thread. Return to all comments →