1. Encoding an decoding -ve integers forums.oracle.com&0xff)<<24)|((b[i+1]&0xff)<<16)|((b[i+2]&0xff)<<8)|(b[i+3]&0xff); i += 4;}; //System.out.println(value); If i give -100 as input it is giving 28 as output..by taking 2's complement i think...but i want it to recognise as -100 and encode it...plzz help me in this regard....How do i modify the encoding and decoding code above to handle -ve integers.....???? regards kiran | |||||||||||||||||
2. Largest integer program? forums.oracle.comThis is what I've done so far: public class UwagzKa { public static void main (String[] args){ int a = 0; int min = 0; int max = 0; int num = 0; do { System.out.print("Enter numbers-->"); num = SavitchIn.readLineInt(); if(num==0) System.out.println("Numbers must be positive"); } while(num>0); while(num>0) if (num > 0){ min = num; max = num; } else if ... | |||||||||||||||||
3. Finding duplicate entries in an int[] forums.oracle.comOkay, So I need to solved the following problem. Given an int[] or Integer[] with 1,000,000 entries. There are 2 entries out of the 1,000,000 that are duplicate. I need to find and return the duplicate entry. Obviously iteration is out of the question given the size of the array, and converting to an arraylist would likewise not help alot. Please ... | |||||||||||||||||
4. java application subtracting,multipling and dividing integers forums.oracle.com | |||||||||||||||||
5. Problem with a key pushed and an int that increases forums.oracle.comHey, I'm working on an checkers game and I'm trying to switch between my black and white checker by letting an int increase by pushing the SpaceBar. My problem is that when I use my mouse or press another key then the spacebar the int increases. I'm working by MVC so I my controller is: public void keyPressed(KeyEvent e) { switch ... | |||||||||||||||||
6. how do use the method record(int score) in this code? forums.oracle.com | |||||||||||||||||
7. Positive Integers only? forums.oracle.com | |||||||||||||||||
8. problem with defining ints forums.oracle.com | |||||||||||||||||
9. int i='\u000a' cannot compile forums.oracle.com | |||||||||||||||||
10. Drop the minus from an int forums.oracle.com | |||||||||||||||||
11. Correctly displaying an int. forums.oracle.com | |||||||||||||||||
12. Int cannot be dereferenced forums.oracle.comFirst off, it's nice that you used the code tags, but clean up your indentation. Now then, ints are primitives. As such, they are not reference types and cannot be the target of method invocations. Go to the line number specified in your error message. Somewhere on that line, you are trying to call a method on a variable of type ... | |||||||||||||||||
13. int.class forums.oracle.com | |||||||||||||||||
14. the game with integers forums.oracle.com | |||||||||||||||||
15. Use a void method as int? forums.oracle.com | |||||||||||||||||
16. Updating an Integer... forums.oracle.com | |||||||||||||||||
17. int cannot be dereferenced forums.oracle.com | |||||||||||||||||
18. A question about immutable object: Integer forums.oracle.comOne could argue for the precision of such convoluted explanations of pass by value. The statement "Java is pass-by-value" isn't convoluted at all. It's not only the way Java actually works, it's the simplest explanation. Any other "explanation" requires all kinds of exceptions and special cases, and is ultimately incorrect. when you say Integer i = new Integer(); So youre not ... | |||||||||||||||||
19. Setting so that Integers produced by program must = or > 0? forums.oracle.comOn my payroll program, I'm getting really close to what I need...the only thing is, certain values that are calculated by my program could potentially come out negative. The assignment requires that some of these values (taxable income, tax rate, paycheck) must always be equal to or always 0. So if the variables inputted produced a negative number, the program would ... | |||||||||||||||||
20. A small problem with Integer counter forums.oracle.com | |||||||||||||||||
21. How do I determine if an inputed integer takes the form of a^b for b>1 forums.oracle.comI am trying to write a program that uses the ASK prime test algorithm, as described here. How can I test to see if an inputted integer is made up of one same number multiplied a whole bunch of times? Example: 625 takes the form of a^b because 625=5x5x5x5= 5^4 88 does not take the form of a^b because 88=2x2x2x11=2^3x11 It ... | |||||||||||||||||
22. read integer forums.oracle.com | |||||||||||||||||
23. OutOfMemoryError at 2x9 million INTs? forums.oracle.com | |||||||||||||||||
24. int Significant Figures forums.oracle.com | |||||||||||||||||
25. Reading part of integer forums.oracle.com | |||||||||||||||||
26. Why does Stack | |||||||||||||||||
27. integer display program forums.oracle.compublic void Display() { System.out.println("The integer is " + no); } } UtilShow.java file import java.io.*; public class UtilShow{ public static void main(String[] args) { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); Show one = new Show(); System.out.print("Input the integer: "); one.show(br.readLine()); one.Display(); } } Please help. Thanks alot! | |||||||||||||||||
28. why we can not initialize Integer object forums.oracle.comYou shouldn't be questioning the compiler. When you ask a question like this it implies that you're thinking "I'm doing everything correctly; why is the compiler acting so strangely?" Any time you get an error from the compiler, believe it. It means that YOU did something wrong. Go back and look at the javadocs, because it usually means that you're assuming ... | |||||||||||||||||
29. Condense int declarations into one line forums.oracle.com | |||||||||||||||||
30. Positive Big Integer forums.oracle.com | |||||||||||||||||
31. int question forums.oracle.comHi, This is actually more for my mum than me (bizarrely enough). Basically she has a program that stores telephone numbers (for a class - not for real) She's storing uk area codes using ints and is trying to say something along the lines of: int areaCode = 0141; Apart from the obvious fact that you would use a String to ... | |||||||||||||||||
32. Stuffing two shorts into an int forums.oracle.comNormally I would agree with you. However, this is the only way I can make a system I am working on compatible with a legacy system. The new system will stuff two shorts into an int for the legacy system, and then when the new system gets the same data back, it will need to recover the two shorts from the ... | |||||||||||||||||
33. Int cannot be dereferenced forums.oracle.comhi im pretty new to java and i write an event-handler and i get the message rekenmachineApplet.java:94:13: int cannot be dereferenced i'll send the event-handler. rekenmachineApplet.java:94:13: int cannot be dereferenced public void plusKnopActionPerformed(ActionEvent evt) { int getal1; getal1 = Integer.parseInt(getal1Veld.getText()); int getal2; getal2 = Integer.parseInt(getal2Veld.getText()); int getal3; getal3 = (getal1 + getal2); int getalVeld; getalVeld.setText(getal3); } | |||||||||||||||||
34. Increment Integer object forums.oracle.comOk, I will probably get told off for this question, called a n00b or whatever and told to read stuff. I've looked and havent found anything or I've just missed it. I'm storing keys and values in a map (abviously). The map just stores sizes. I have a main list. Joe might have 10 items on the list and Kate might ... | |||||||||||||||||
35. Int Placemarker? forums.oracle.comHey, I am writing a program and I started by putting all the numbers in strings. The reason they are in strings is because I need to later pick out specific characters. I need a number such as 25 to be 025 or 0025 to hold its place depending on what I set it at. The thing is, when I parse ... | |||||||||||||||||
36. Print Ascending or Descending Integers on one line. forums.oracle.com1) remove these codes inside "switch(order)" System.out.println(); // this cause printing of extra line 2) change System.out.println(numberTwo); // the println print an line after every number System.out.print(numberTwo+" "); // print only a space after every number and do the same for numberOne. 3) final codes for numberOne System.out.print(numberOne+" "); numberOne = numberOne + 1; Edited by: lazy_programmer on Oct 16, 2007 ... | |||||||||||||||||
37. getting an integer between two other integers forums.oracle.com | |||||||||||||||||
38. A basic text/string equality question forums.oracle.comText myField; System.out.println((myField.getText() == "x")+ " because:>" + phoneField.getText() + "< is different than: x"); The result is the following printed to my console false cause: >x< is different than: x How can this be that "x" doesn't equal "x"? I thought maybe a text object doesn't resolve to a string but casting with (String)myField.getText doesn't change the outcome either. I'm ... | |||||||||||||||||
39. A simple Type Casting/Equality question forums.oracle.comHi guys... This is my first post! What is the difference between these two code fragments that give different outputs? 1. Integer a = 200, b = 200; System.out.print(a==b); //returns false - as I expect 2. Integer a = 20, b = 20; System.out.print(a==b); //returns true - as I do not expect Note: The threshold value for variables is 128! Output ... | |||||||||||||||||
40. Set a pixel int in buffered image forums.oracle.comHi, iam writing a program in which i would like to set the value of a pixel in a BufferedImage. I have managed to extract a pixel from the BufferedImage and also get the red, green and blue values from this pixel (confusing in itself). Now I am wanting to change those values and convert the three individual ints (red, green ... | |||||||||||||||||
41. To determine the no. of leading 0's in an int forums.oracle.comHi, I'm trying to determine the no. of leading 0's in an int. I have something like: int num = 000012345; And for this i want the result to be 4. Is there a way for me to achive this without actually converting my int into a String ? Pls advice. Note: I tried using Integer.numberOfLeadingZeros(). But i'm getting the result ... | |||||||||||||||||
42. PixelGrabber.getPixels returns an int[] full of -1's forums.oracle.comIt returns an int[] of nothing but -1 Yes, the image is 1280x960, so it is definitely within the bounds. What I'm trying to do is take a screen shot, which I know worked because I can set it as an icon or save it to a file just fine. Within that screen shot I'm trying to read certain areas of ... | |||||||||||||||||
43. What does WIDTH of integer types means ? forums.oracle.com | |||||||||||||||||
44. What is the Difference between Integer and int? forums.oracle.com | |||||||||||||||||
45. changing int into object forums.oracle.comif you need to add int primitive to ArrayList or any other structured data type you have no need to cast to Object as Onject extends every other object so you should be able to add the Integer object to your arraylist or whatever. As I said I see no need in casting Integer class instances to Object instances. | |||||||||||||||||
46. int[] or List | |||||||||||||||||
47. Integer! forums.oracle.comis there anyway we can set an integer to null? For example: int manufacturer_id =Integer.parseInt(request.getParameter("idtf")); if(manufacturer_id!=null){ out.println("hello!"); } I will always get an error saying that it is incompatible type. so i will have to code it this way: if(manufacturer_id != 0) but this is not effective, unless a person type 0 but not other thing then it will go into ... | |||||||||||||||||
48. int a = b ? c : a forums.oracle.com | |||||||||||||||||
49. problem in reading integers data forums.oracle.comhi all, i'm reading integers from console and storing them in a file and then reading back, but my data is inconsistent.can anybody tell me the reason for this. heres my code snippet... DataInputStream in = new DataInputStream(System.in); DataOutputStream out = new DataOutputStream(new FileOutputStream("intdata.txt")); try{ int a = in.readInt(); out.writeInt(a); out.close(); in.close(); }catch(EOFException eofe){ throw new RuntimeException(eofe); } DataInputStream in2 = ... | |||||||||||||||||
50. Button to int forums.oracle.com | |||||||||||||||||
51. search the integer forums.oracle.comHi guys can anybody help me with this one? I have a file with one string or integer in each line. Now i have to search the highest and lowest number from the file and print it to the console. I know i have to assume each string as an integer, but i don't how to code them. my file (findInt.dat) ... | |||||||||||||||||
52. Passing a textvalue as an int to a method forums.oracle.com | |||||||||||||||||
53. Find the closest Integer to a given Integer in a Vector/List forums.oracle.comMost of these biggest/smallest/greenest/etc problems are got at the same way: (1) Start with a sensible value for the "result". Often the first element of the list. (2) Write a loop that goes through the list. Compare the list item with the result to see if it is bigger/smaller/greener/etc. If it is it can replace the result. (3) Once the loop ... | |||||||||||||||||
54. java.lang.NullPointerException about the list.add(Int , Object) forums.oracle.comI want to get a list of the table VwOdaycount ,the list should contain the fday (taken as the key word of the list) and the fcount(taken as the object of the list). the HQL is ""select model.fday,model.fcount from VwOdaycount as model where model.fitemId="+itemID + "and model.fyear=" +year +"and model.fmonth="month"order by model.fday asc"; " using the Hibernate version:3.01 failure Trace is ... | |||||||||||||||||
55. least common multiple for multiple integers forums.oracle.comWarnerja, thanks for the instant reply. I thought of this: from LCM(LCM(a, b), c) we can get a common multiple for a, b, c. but can we ensure this common multiple is least? LCM(a, b, c) == LCM(LCM(a, b), c) -> is this proven by math theory? (I am not good at math, so not sure) | |||||||||||||||||
56. effective integer maximum forums.oracle.comHello, Am I correct in saying that the integer maximum is 0xFFFFFFFF or is it something less than that? Or does it vary by machine? Is there some global variable/function I can call up and just get it without having to define it myself? The reason is that I have a counter type variable that I expect to get up very ... | |||||||||||||||||
57. Adding Integer forums.oracle.com | |||||||||||||||||
58. Entering integers forums.oracle.comHi this is my first yr using java and I am so confice so I need some help. I need to do a program where the user needs to input an integer of 3 digits but if the user enter less or greater then 3 digits the program needs to return an error message. I need to do it with out ... | |||||||||||||||||
59. Ascending Integers forums.oracle.comyeah normally assignments (well at my school) will want you to adapt methods learnt in the weeks prior to the assignment. Although, i know one of the first things i learnt was how to use the API... which was also part of my first assignment so maybe you could. Should ask the teacher though incase i guess | |||||||||||||||||
60. Type safety: The method add(int, Object) belongs to the raw type List. Refe forums.oracle.comok many thanks for your help!! I'm having a graph with several nodes and want to store the values of their attributes in Lists. The data types of these attributes are String, Double, Char. First of all I wanted to build a List containing all x-coordinates of the nodes which are double | |||||||||||||||||
61. Adding to an integer in another class forums.oracle.com | |||||||||||||||||
62. Which is better int or Integer ?? forums.oracle.comHi, java supports both primitives and objects. int is a primitive, Integer is an object. int is a just simple integer type, which comes from c++ or c or whatever it has nothing to do with objects, simple. On the other hand Integer is a huge fat class, which has many usefull methods such as coverting to String and to other ... | |||||||||||||||||
63. I need some Help with using Big Integers forums.oracle.comI asked a lot of ppl how to do this but they told me to do it either in Vectors or in Arrays. I don't know any thing about Vectors and just basicly understand Arrays. I would rather do this in Arrays than in Vectors. I would Appreciate any help that I can get. Thank You. | |||||||||||||||||
64. Problem instatiating Integer forums.oracle.comIf I try to compile I get the following error: "unexpected type found: type parameter Integer required: class" My JDK version is 1.5.0.04 I haven't seen this problem in the forums. Everything that I've read indicates that this is legal; What am I missing? I've been looking at this so long that my eyes are crossed.[ | |||||||||||||||||
65. Fundamental Question about int vs Integer forums.oracle.comThe basic answer is that int is a primitive, and Integer is a class. Integer is a wrapper for ints, meaning it was designed to allow you to conveniently use a primitive int where only objects were allowed. Java 5 has a feature called autoboxing that allows you to use them somewhat interchangably. | |||||||||||||||||
66. Integer forums.oracle.com | |||||||||||||||||
67. Object storing an int forums.oracle.com(This is from a previous post about the bus) For the Queue class (and in general) when I want to add to my list I must pass in an object. How do I encapsulate an integer in the object and how can I compare the object (as an integer) to another interger? Thanks for all your help, sorry I'm a beginner. ... | |||||||||||||||||
68. displaying null when trying to read integer type from excell sheet forums.oracle.comConnection C=DriverManager.getConnection("jdbc:odbc:mydsn3"); out.println("Connected: " + !C.isClosed() + "\n"); out.println("Catalog: " + C.getCatalog() + "\n"); Statement S = C.createStatement(); ResultSet rs = S.executeQuery("SELECT * FROM [Sheet1$]"); //ResultSet rs = S.executeQuery("SELECT * FROM [test$]"); ResultSetMetaData rsStruc = rs.getMetaData(); out.println("Table: " + rsStruc.getTableName(1) + ""); out.println("
|