after execution of my program written in java I see this output:
java result: 2147483647
What does this number means anyway? T
It's the exit code from the (JVM) process. Specifically, it's the one you'll get when you kill it. Unknown Java Result Message
You assign Integer.MAX_VALUE
in five different places in your code; one of the locations is elements in the mins
array.
This code near the end of your main()
method can print out values from the mins
array:
int result = 0; for(int i=0;i<A;i++){ if (mins[i]>result) result = mins[i]; } if(result==Integer.MAX_VALUE){ System.out.println("IMPOSSIBLE"); } else{ System.out.println(result); } } else{ System.out.println("IMPOSSIBLE"); }
Here's a small test program to find out what Integer.MAX_VALUE
actually is:
$ cat test.java ; javac test.java ; java sars
class sars {
public static void main(String args[]) {
System.out.println("Integer.MAX_VALUE: " + Integer.MAX_VALUE);
}
}
Integer.MAX_VALUE: 2147483647
I was wrong in my earlier comment about a -1 leaking through somewhere -- you've embedded the funny value five times into your code. :) I don't know which one is leaking out, or if your algorithm is actually working exactly as it should. Good luck hunting that down :) but at least with your full code posted, someone may help you find what we're both missing.
It is because of the date and time. It means that you have some files that edited in a date or time after your current date and time. set your date and time to a valid date and then run your program.
Let the Java code end explicitly with an System.exit(0)
Well, you haven't shown how you're executing your program or what your program does. I would guess it could be the exit code of the process, although usually if there aren't any errors, the exit code is 0.
If you want a better answer, please provide more information in the question.
If you have a default NetBeans project, and you're launching it from NetBeans, then it's being launched by Ant, using the generated build script that's inside your project directory. To narrow down the problem, try launching the program yourself from the command line:
java acm.mamoth