Rounding a double to 5 decimal places
How do I round a double to 5 decimal places, without using DecimalFormat? ...
How do I round a double to 5 decimal places, without using DecimalFormat? ...
Sorry, I'm new to Java, so this question might be unclear. I have been recently dealing with enclosing a try and catch statement in a while loop, because I wanted to make sure that getting input was enclosed from the rest of the program. I have come across a problem where using an exclamation mark in front of a variable in the while con...
Hi guys.. I've been searching high and low on this problem. Still can't find the solution. Basically, I want to transfer an encrypted file via OBEX Push Service (bluetooth) from client (j2me) to server (j2me). In emulator, it works fine. Client able to successfully do a bluetooth discovery lookup on the server. But, when I put the appli...
I have a series of numbers, i.e. 6, 5, 7, 8, 9, 1, which through some mathematical process I will eventually obtain through repetition. For this reason, I want to use a vector to store the last six numbers yielded by this process and then compare the contents of that vector to the series of numbers above. If it identically matches the se...
I have a test class, written in JUnit4 syntax, that can be run in eclipse with the "run as junit test" option without failing. When I run the same test via an ant target I get this error: java.lang.Exception: Test class should have public zero-argument constructor at org.junit.internal.runners.MethodValidator.validateNoArgConstructor(Me...
For some unknown reason HDScanner started a deploy-undeploy infinite loop for my (exploded) application deployment, removing and adding it again and again every 15 seconds or so. I already tried to remove the application by hand (I normally use seam restart or seam unexplode) and also removed the whole contents of the jboss-5.1.0.GA/ser...
Why does the setColor of a Graphics object reset when I use the repaint method? ...
I could use some guidance on the following problem. The whole "No use of XML libraries is allowed" part is throwing me for a loop. Thanks! Create a java program that takes XML as input, parses the input and writes all the element names to the console indented with tabs to their nesting level. You should handle xml attributes, but you d...
I want to declare a List<int[]> or Map<int[],Boolean> but it's very difficult because arrays in Java doesn't implement the equals() method. If two arrays a and b are equal, a.equals(b) returns false. Although java.util.Arrays.equals() compares arrays for equality, how do I get a List to use that method for comparison instead of the scre...
I need infinite value to set for some edges in graph that do not exist. i cannot use negative values. I perhaps need to set largest possible value of int as infinite, but need to do that in platform independent way. What is the best value to use for infinite value ...
I've seen "swingx" mentioned and referred to here. However, every time I try to visit the site: http://swinglabs.org/ It's down! Is this still an active, viable project? Or is it outdated and abandoned? ...
I'm writing a Java application using Struts 2, but now I'd like to make it a hybrid Java & Scala project instead. I don't have much experience with Scala, but I learned Haskell years ago at college -- I really liked the functional programmed paradigm, but of course in class we were only given problems that were supremely suited to a func...
My Apache Tomcat Server is getting periodic updates from a Java based client Application, At the moment the scenario is just one client and talking to the server. I want to log the messages from the client onto the server with time-stamp what kind of framework will help me in achieving this? ...
I'm trying to computing a few things in a simple java application for school. A user must into 2 integers and once you input those variables in it will spit out the sum, product, quotient and difference. I am only able to get the program to spit out sum but not product, quotient and difference. any suggestions? here is my code: // This ...
I have made a very basic paint brush application in java. I want to enhance this application to be shared across users on the internet so that we can simultaneously share the instance and work collaboratively on the paint screen. [i got this idea form the doodle work env in yahoo messenger] I am not sure if this would be acheived by ne...
To build a Web Application, what kind of open source web application frameworks / technologies are currently present that would be: Faster to learn. Ease of use. Have widgets for rapid development(From a GUI perspective). Database integration. I would want this web app to communicate to a Java client. I am not bound to Java ...
Does anyone know of a library to read/write the Xcode project files .xcodeproj/.pbxproj? Any language is welcome. Thanks in advance. ...
I want to transmit a serialized object over a socket channel. I want make "Hi friend" string as serialized object and then write this object in socket channel while in the other end i want to read the same object and retrieve the data. All these things I want to do using Java SocketChannel. How to do this? I have tried like below, but d...
I am looking an algorithm that can map between characters with diacritics (tilde, circumflex, caret, umlaut, caron) and their "simple" character. For example: ń ǹ ň ñ ṅ ņ ṇ ṋ ṉ ̈ ɲ ƞ ᶇ ɳ ȵ --> n á --> a ä --> a ấ --> a ṏ --> o etc UPDATE 1) I want to do this in Java, although I suspect it should be something unicode-y a...
I found similar questions asked here but there weren't answers to my satisfaction. So rephrasing the question again- I have a task that needs to be done on a periodic basis (say 1 minute intervals). What is advantage of using Timertask & Timer to do this as opposed to creating a new thread that has a infinite loop with sleep? Code snip...