Java OOA&OOD
xuang
这个作者很懒,什么都没留下…
展开
-
Parsing and Formatting a Big Integer into Binary, Octal, and Hexadecimal
[code="java"]BigInteger bi = new BigInteger("1023");// Parse and format to binarybi = new BigInteger("1111111111", 2); // 1023String s = bi.toString(2); // 1111111111// Parse ...原创 2010-01-30 20:02:58 · 88 阅读 · 0 评论 -
Parsing and Formatting a Byte Array into Binary, Octal, and Hexadecimal
[code="java"]// Get a byte arraybyte[] bytes = new byte[]{(byte)0x12, (byte)0x0F, (byte)0xF0};// Create a BigInteger using the byte arrayBigInteger bi = new BigInteger(bytes);// Format t...原创 2010-01-30 20:05:08 · 79 阅读 · 0 评论 -
Setting the Decimal Place of a Big Decimal Value
[code="java"]int decimalPlaces = 2;// Truncates the big decimal value.bd = bd.setScale(decimalPlaces, BigDecimal.ROUND_DOWN);String string = bd.toString();[/code]原创 2010-01-30 20:06:52 · 145 阅读 · 0 评论 -
Getting the Login Name of the Currently Logged-In User
[b]This example retrieves the login name of the user that is running the application. [/b][code="java"]try { String loginAppName = "GetLoginNameUnix"; // If the application is run on...原创 2010-01-30 20:16:17 · 147 阅读 · 0 评论