Divide one BigDecimal from another BigDecimal : BigDecimal « Data Type « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » Data Type » BigDecimal 




Divide one BigDecimal from another BigDecimal
     

import java.math.BigDecimal;

public class Main {
  public static void main(String[] argvthrows Exception {
    BigDecimal bd1 = new BigDecimal("123456789.0123456890");

    // Create via a long
    BigDecimal bd2 = BigDecimal.valueOf(123L);

    bd1 = bd1.divide(bd2, BigDecimal.ROUND_UP);

  }
}

   
    
    
    
    
  














Related examples in the same category
1.Round a double
2.Create Big Decimal Values via a long
3.Create a BigDecimal vis string
4.Multiply one BigDecimal to another BigDecimal
5.Subtract from one BigDecimal another BigDecimal
6.Negate a BigDecimal
7.Setting the Decimal Place of a Big Decimal Value
8.Truncates the big decimal value
9.Do math operation for BigDecimal
10.Operate with big decimal values
11.Round a double by setting the scale
12.Create Big Decimal Values via a string
13.Calculation with BigDecimal
14.Parse BigDecimal
15.Formats BigDecimal into a SQL floating-point literal
16.Value is rounded using the given method which is any method defined in BigDecimal
17.Round the given value to the specified number of decimal places. The value is rounded using the BigDecimal.ROUND_HALF_UP method.
18.Convert Object to BigDecimal
19.BigDecimal and BigInteger sqare root
20.BigDecimal quadratic
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.