List of usage examples for java.math BigDecimal BigDecimal
public BigDecimal(long val)
From source file:com.softserveinc.internetbanking.testit.JDBCtemplateMoneyTransaction.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml"); MoneyTransactionJDBCTemplate moneyTransactionJDBCTemplate = (MoneyTransactionJDBCTemplate) context .getBean("moneyTransactionJDBCTemplate"); System.out.println("------Records Creation--------"); BigDecimal number = new BigDecimal("200.00"); moneyTransactionJDBCTemplate.createTransaction(1, 3, number); moneyTransactionJDBCTemplate.createTransaction(1, 3, number); }
From source file:BigDSqrt.java
public static void main(String[] args) { double value = 1.0; String numS;//from ww w . j a v a2 s .c om int scale = 30; BigDecimal v; System.out.println("Big decimal square root routine\n"); numS = Keyin.inString("Enter value: "); scale = Keyin.inInt("Enter scale: "); // Convert value to big decimal format v = new BigDecimal(numS); System.out.println(sqrt(v, scale)); }
From source file:br.com.joaops.springdatajpajavaconfigfirebird.Main.java
public static void main(String[] args) { try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( DataConfiguration.class)) { BookService service = context.getBean(BookService.class); Book book = new Book("First Book", new Date(), 33, new BigDecimal(26.50)); service.save(book);/*from w w w . ja va 2s . co m*/ List<Book> books = service.findAll(); for (Book b : books) { System.out.println(b); } } }
From source file:siia.monitoring.wiretap.WireTapDemo.java
public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("context.xml", WireTapDemo.class); MessageChannel debitChannel = context.getBean("debitChannel", MessageChannel.class); Message<Debit> message1 = MessageBuilder.withPayload(new Debit(new BigDecimal(5000), "SMALL")).build(); Message<Debit> message2 = MessageBuilder.withPayload(new Debit(new BigDecimal(25000), "BIG")).build(); debitChannel.send(message1);//from ww w . j a v a 2s . c o m debitChannel.send(message2); }
From source file:Main.java
public static void main(String[] argv) throws Exception { String driverName = "com.jnetdirect.jsql.JSQLDriver"; Class.forName(driverName);/*ww w .ja va 2 s. c o m*/ String serverName = "127.0.0.1"; String portNumber = "1433"; String mydatabase = serverName + ":" + portNumber; String url = "jdbc:JSQLConnect://" + mydatabase; String username = "username"; String password = "password"; Connection connection = DriverManager.getConnection(url, username, password); String sql = "INSERT INTO mysql_all_table(" + "col_boolean," + "col_byte," + "col_short," + "col_int," + "col_long," + "col_float," + "col_double," + "col_bigdecimal," + "col_string," + "col_date," + "col_time," + "col_timestamp," + "col_asciistream," + "col_binarystream," + "col_blob) " + "VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; PreparedStatement pstmt = connection.prepareStatement(sql); pstmt.setBoolean(1, true); pstmt.setByte(2, (byte) 123); pstmt.setShort(3, (short) 123); pstmt.setInt(4, 123); pstmt.setLong(5, 123L); pstmt.setFloat(6, 1.23F); pstmt.setDouble(7, 1.23D); pstmt.setBigDecimal(8, new BigDecimal(1.23)); pstmt.setString(9, "a string"); pstmt.setDate(10, new java.sql.Date(System.currentTimeMillis())); pstmt.setTime(11, new Time(System.currentTimeMillis())); pstmt.setTimestamp(12, new Timestamp(System.currentTimeMillis())); File file = new File("infilename1"); FileInputStream is = new FileInputStream(file); pstmt.setAsciiStream(13, is, (int) file.length()); file = new File("infilename2"); is = new FileInputStream(file); pstmt.setBinaryStream(14, is, (int) file.length()); file = new File("infilename3"); is = new FileInputStream(file); pstmt.setBinaryStream(15, is, (int) file.length()); pstmt.executeUpdate(); }
From source file:com.medlog.webservice.util.MathUtl.java
public static void main(String[] args) { BigDecimal d;/* w w w . java 2s .c om*/ d = new BigDecimal(0); double[] xs = { 30, 80, 90, 70, 70, 80, 50, 50, 50, 100, 10, 40, 80, 100 }; double ys[] = { 52.9676423, 28.14739166, 45.22978518, 60.54520645, 58.43671379, 15.94587142, 58.869, 57.8465, 58.686, 40.38026666, 55.8178, 60.3812, 88.1389, 61.1895 }; double r = new PearsonsCorrelation().correlation(xs, ys); double rb = new SpearmansCorrelation().correlation(xs, ys); System.out.println("com.medlog.webservice.util.MathUtl.main()" + r * r); System.out.println("com.medlog.webservice.util.MathUtl.main()" + rb * rb); }
From source file:uk.co.onehp.trickle.dao.HibernateMarketDaoCustomT.java
@Ignore public static void main(final String[] args) { final ApplicationContext applicationContext = new ClassPathXmlApplicationContext( "classpath:/spring-trickle.xml"); final MarketDao marketDao = (MarketDao) applicationContext.getBean("marketDao"); final HorseDao horseDao = (HorseDao) applicationContext.getBean("horseDao"); final Market market = new Market(7483, "Market"); final Meeting meeting = new Meeting(234, "Meeting"); final Race race = new Race(867, "Race", new LocalDateTime(), "meeting"); final Horse horse = new Horse(); final Pricing pricing = new Pricing(new BigDecimal("3.45"), new BigDecimal("3090.96"), BettingAspect.BACK); horse.setRunnerId(441);/*from ww w . ja v a 2 s .co m*/ horse.setRaceId(867); horse.setRace(race); horse.setPrices(Lists.newArrayList(pricing)); race.addHorse(horse); meeting.addRace(race); market.addMeeting(meeting); marketDao.saveOrUpdate(market); System.out.println(marketDao.getMarket(7483)); }
From source file:br.com.itfox.beans.SendHtmlFormatedEmail.java
public static void main(String[] args) { try {//from ww w . j a v a 2 s . c om //new SendHtmlFormatedEmail().sendingHtml(); String assunto = ""; Mensagem msg = new Mensagem(); // localizando a mensagem msg = new BusinessDelegate().getMensagem(new BigDecimal(61)); assunto = msg.getAssunto(); new SendHtmlFormatedEmail().sendingHtml("belchiorpalma@gmail.com", "Belchior", assunto, 2); } catch (Exception ex) { Logger.getLogger(SendHtmlFormatedEmail.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.discursive.jccook.lang.builders.reflect.PoliticalCandidate.java
public static void main(String[] args) { // START lang-ex-sample-1 // Create a State State va = new State("VA", "Virginia"); // Create a Birth Date Calendar calendar = new GregorianCalendar(); calendar.set(Calendar.YEAR, 1743); calendar.set(Calendar.MONTH, Calendar.APRIL); calendar.set(Calendar.DAY_OF_MONTH, 13); Date dob = calendar.getTime(); BigDecimal moneyRaised = new BigDecimal(293829292.93); // Create a Political Candidate PoliticalCandidate candidate = new PoliticalCandidate("Jefferson", "Thomas", dob, moneyRaised, va); System.out.println(candidate); // END lang-ex-sample-1 }
From source file:com.discursive.jccook.lang.builders.customized.PoliticalCandidate.java
public static void main(String[] args) { // Create a State State va = new State("VA", "Virginia"); // Create a Birth Date Calendar calendar = new GregorianCalendar(); calendar.set(Calendar.YEAR, 1743); calendar.set(Calendar.MONTH, Calendar.APRIL); calendar.set(Calendar.DAY_OF_MONTH, 13); Date dob = calendar.getTime(); BigDecimal moneyRaised = new BigDecimal(293829292.93); // Create a Political Candidate PoliticalCandidate candidate = new PoliticalCandidate("Jefferson", "Thomas", dob, moneyRaised, va); System.out.println(candidate); }