Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.math.BigDecimal;

public class Main {
    public static String getNormal(String txamt) {
        String str = txamt;
        if (str != null) {
            try {
                String sum = "";
                int index = 0;
                char c = str.charAt(index);
                while (c == '0') {
                    index++;
                    c = str.charAt(index);
                }
                sum = str.substring(index);
                double i = Double.parseDouble(sum);
                i = i / 100;
                BigDecimal bg = new BigDecimal(i);
                double j = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
                sum = "" + j;
                return sum;

            } catch (Exception e) {

                e.printStackTrace();
            }
        }
        return null;
    }
}