Skip to content

Instantly share code, notes, and snippets.

@bekce
bekce / CustomDecimalFormat.java
Last active October 7, 2020 06:29
Custom Decimal formatting in Java with custom decimal separator and thousand separator, forced fraction and decimal places options, regardless of locale.
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.util.Currency;
import java.util.Locale;
public class CustomDecimalFormat {
public static DecimalFormat prepareFormat(char decimalSeparator, char thousandSeparator, boolean forceFraction, byte decimalPlaces){
String pattern = "#,###.";
@bekce
bekce / setup.sh
Last active February 20, 2019 13:45
My usual list of commands to be applied to a new centos 7 vps
set -e
yum -y update
# Install Java
cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
"https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz"
tar xzf jdk-8u201-linux-x64.tar.gz
cd jdk1.8.0_201/