Efficiency of Long objects over Integer objects? any ?

I have a Long object which actually only stores "integer" values and we had coded it that way long before we realised it. Now I am told we need to change the LONG object to INTEGER object to improve Java efficiency. I disagree with that. Note that we are not doing any ARITHMETIC operations on the Long object at all. I understand that it would be efficient to use Integer object if theres a lot of arithmetic operations being done on it. But since we are not how is converting of Long objects to Integer going to improve my efficiency? and moreover since only integer values are stored in the Long object I dont see any memory allocation lose too....am i right in my posture?
Thanks

Thanks for quick reply ! are you saying Long and
Integer occupy same amount of memory space if the Long
object contains integer value ?No.
You said:
moreover since only integer values are stored in the Long
object I dont see any memory allocation lose too....am i right in my posture?I took that to mean that you thought that since the Longs contain a smaller (int-sized) values, that they're taking up the same space as Integers, and therefore you won't save any memory by switching to Integers.
That's not in fact the case. A Long takes up the same amount of space regardless of whether it's holding 0 or 1 or Integer.MAX_VALUE or Long.MAX_VALUE, and that space is probably slightly bigger (2 bytes bigger, I'd guess) than what Integer uses.
So technically, you will save some space (probably) by going to Integer. However, unless you have a huge number of these objects, that space savings will be minimal, and unless you've actually seen numbers in a profiler, it's pointless to speculate.

Similar Messages

  • Find long running database objects over week (without using V$ views)

    find long running database objects over week (without using V$ views) as v$ views contains information only upto objects resides on main memory . I want to know the objects which takes highest time withing one week.

    Hello,
    welcome to the forum.
    This is the forum for the tool {forum:id=260}. Your question about v$views should be posted in {forum:id=61} or {forum:id=75}. There is a FAQ {message:id=9360002}: especially the part about providing essential informations like 4 digit version number :-)
    Regards
    Marcus

  • SelectManyListBox is not working for Integer Objects in Jsf

    hi,
    In JSF selectManyListBox is not working with Integer objects it is working only with String Objects. It is showing the error "value is invalid" can anybody please send me sample code snippet regarding this.

    The javadoc of UISelectMany.validateValue() says:
    In addition to the standard validation behavior inherited from UIInput, ensure
    that any specified values are equal to one of the available options.
    So, you should take care that the submitted values are equal to one of the
    options. Note that an Integer is never equal to a String.
    Show your codes to us.

  • How to change the value in an Integer object?

    Hi,
    Is it possible to change the value that is contained in an Integer object.
    I know Integer objects are immutable. So it might not be possible to chage to value in an integer object once its been initalized a value @ the time of construction.
    Also does autoboxing and unboxing feature of 1.5 help acheive this?
    Please let me know of any other alternative
    Thanks
    Deepak

    Tried the autoboxing and unboxing feature doesnt
    help.It doesn't help in general. But in this special case it doesn't help because it doesn't anything to do with it. Do you really know what you're doing?
    So across the function its not changing the value.
    As I have created an object of Integer class and
    passed a reference of that object into the chage()
    ,So any changes should have been reflected
    acrosss method calls.?Since you let the newly created parameter-reference a point to a new Integer object: no. Why? You have two references to I(31). Then you move one reference to I(33). Why should 31 get another value?
    Does the the java compiler creates a new Integer
    object each time it does autoboxing Not necessarily. Some values are pooled. Actualy, the JVM does it. The compiler never creates any object.
    so that the value
    is lost across method calls?That's not the compiler's or the JVM's fault. It's all a misconception of yours.
    Is there any means to achieve this?What for?
    int a = 0;
    a = change(a);
    int change (final int i) {
      return i + 12;
    }Does exactly what you want, without side-effects.

  • Problem in passing/returning objects over dynamic web service call

    Hi Friends,
    I am beginner in java web service.
    Here is the problem I am facing when I pass/return user defined objects to remote web service method using dynamic we service call.
    The client can call the remote web service method in 2 ways.
    1. By generating client stubs using WSDL file
    - In this case, I am able to pass/return the user defined objects to remote method without any issue only when the server side web services are deployed in any server(jboss)
    - But in java 1.6 & above, the web services can be deployed without server using endpoint. In this case, I am not able to pass/return objects over web service calls.
    2. Without generating client stubs (dynamic web service call)
    - This will establish a connection at run time using the given WSDL file (I have attached the document). I have to form an XML(This will contain API name, arguments) string as input at run time
    - In this case, it allows only string as argument while passing & returning.
    Please let me know if you can help me on this.
    Regards,
    pani

    I'm not sure about your question, but this might help:
    [http://forum.java.sun.com/thread.jspa?threadID=5251188|http://forum.java.sun.com/thread.jspa?threadID=5251188]
    You might also want to read on JAXB.

  • How to use retouch/clone brushes with loupe staying over the object

    I would like to keep the loupe stationary over an object while I use my Aperture retouch/clone brush. Help!

     3 Go to the port forwarding section and copy down the Applied Rules. 
    Example:  
    Network Computer/Device: 192.168.1.100:63145
    Application & Ports Forward:  Application UDP Any -> 6347  
    Note: There may be up to three entries for each one of your Set Top Boxes.G
    Your display obviously is not like mine as mine does not dosplay the port associated with the ip address
    whatever, the STB's start at 192.168.1.100 and icement by 1 for each
    the port addr's will be 63145 alo incrementing by 1
    there is 1 entry for each in my pf list
    however each ip addr also has a port entry starting at 35000 also incrementing by 1 for each ip addr
    For some unknow reason these are duplicated e.g I appear to have 11 entries exaactly the same for each stb and as the fios services rules have no action switc there is nowhere to delete the extraneous garbage.
    Why do you clone the mac addr??

  • Cursor slows down over clickable objects

    hello,
    how do i turn off the feature which causes the cursor to slow down over clickable objects? in system preferences i click on the mouse icon. in that window i set the "tracking speed" to fast. this works except for when the cursor rolls over a clickable object. for example the red yellow and green circles in the top left of a window will reduce the "tracking speed" when the cursor moves over top of them. how do i turn this feature off?
    thanks
    any help is greatly appreciated!
    if you need more info just ask

    -bump-
    is it not possible to turn this feature off?

  • URGENT : Pass non-serializable objects over sockets

    I am working with a non-serializable class.I can't change it to serializable(since it's an API class).I can't create a subclass either as I need to pass the same exact Object .I have tried wrapping it in a serializable class (as transient )but then the particular object that I need is not serialized.Is there a way to pass non-serializable objects over sockets?.Some other way of doing this?. Should i use RMI or Externalize?. Any help would be appreciated.

    {snip}
    Like this:
    public class SerializableLibraryClass extends
    LibraryClass implements Serializable {
    }Then you've got a class that is exactly the same as
    LibraryClass, but is now serializable.Not quite. The base class still isn't Serializable. Take, for example, the following code:
    public class A
        public int a1;
    public class B extends A implements Serializable
        public int b1;
    B beforeSend = new B();
    beforeSend.a1 = 1;
    beforeSend.b1 = 2;
    objectOutputStream.writeObject(b);
    B afterSend = (B)(objectInputStream.readObject());Both beforeSend and afterSend have fields a1 and b1. For beforeSend, a1 = 1 and b1 = 2. For afterSend, b1 = 2 but a1 = 0. The superclass wasn't Serializable; therefore, its members weren't Serialized and, when the object was created on the other side of the stream, a1 was left at its initial value.
    In short, you can't just Serialize the subclass. That Serialization won't apply to its superclasses.

  • Over 60000 objects in prod part

    Hi all, using sql plus I was selected over 60000 objects
    (tables, views, sinonims...). ErWin working all night trying
    to import prod dates! Too big files need min 4 Gb of RAM!
    Jsp pages as Web tiers with apache server and jar/class files - business logic
    show that s e business suite present basic java implementations!
    At that moment looking for any examples with e business suite
    if ant references exist, could be very usefull
    thanks in advance
    Gordan

    Hi HSawwan,
    When I was write Large code - means that e business suite when
    is installed in pc (computer or laptop) using 50 Gbytes and this
    code is writen in JAVA (consist *.class and *.jar files) and looking so good
    and compatible and modern.Its just my comments!
    But DEMO examples is kind of samples whats E Business Suite offer
    for different kind of users, coz at that moment I couldn installing VIS
    on my laptop (I have one MASTER HDD with 160 GB and I think that is
    not enought for VIS instalation, need HDD with 250 Gb)
    Thanks
    Gordan

  • Skipping over incompitable object - on Undeployment of Resource Adpater

              Problem Statement: WLS6.1 SP2 on NT 4.0
              ** Single WLS Admin Server - NOT CLUSTERED****
              1. Deployed Resource Adpater at JNDI IICF.
              2. ManagedConnectionFactoryCreated.
              3. Trying to Undeploy - Generates following errors.
              After effects:
              View JNDI has (access denied). Is JNDI corrput now?
              The IiConnectionFactory is completely serializable. All members are String or
              primitive int types. Only one transient member of PrintWrite.
              Weblogic Log:
              IiManagedConnectionFactory::createConnectionFactory(?):1
              Skipping over incompatible object at name=IICF, className=IiConnectionFactory
              javax.naming.CommunicationException. Root exception is java.rmi.UnmarshalExcept
              ion: failed to unmarshal interface javax.naming.NamingEnumeration; nested except
              ion is:
              java.lang.ClassNotFoundException: IiConnectionFactory: This error could
              indicate that a component was deployed on a cl
              uster member but not other members of that cluster. Make sure that any component
              deployed on a server that is part of a cluster is also deployed on all other
              me
              mbers of that cluster
              java.lang.ClassNotFoundException: IiConnectionFactory: This error could indicate
              that a component was deployed on a cluster me
              mber but not other members of that cluster. Make sure that any component deploye
              d on a server that is part of a cluster is also deployed on all other members
              of
              that cluster
              at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:16
              2)
              at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:10
              6)
              at weblogic.common.internal.WLObjectInputStream.resolveClass(WLObjectInp
              utStream.java:49)
              at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
              :918)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
              at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
              at weblogic.jndi.internal.BindingEnumeration.readExternal(BindingEnumera
              tion.java:65)
              at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1212)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
              at weblogic.rmi.internal.CBVInputStream.readObjectInternal(CBVInputStrea
              m.java:191)
              at weblogic.rmi.internal.CBVInputStream.readObject(CBVInputStream.java:1
              82)
              at weblogic.rmi.internal.CBVInputStream.readObject(CBVInputStream.java:1
              69)
              at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
              at weblogic.rmi.internal.BasicRemoteRef.unmarshalReturn(BasicRemoteRef.j
              ava:232)
              at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
              ef.java:263)
              at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
              ef.java:229)
              at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
              at $Proxy49.listBindings(Unknown Source)
              at weblogic.jndi.internal.WLContextImpl.listBindings(WLContextImpl.java:
              309)
              at javax.naming.InitialContext.listBindings(InitialContext.java:399)
              at weblogic.management.console.webapp._jndi.__nav.printContext(__nav.jav
              a:116)
              at weblogic.management.console.webapp._jndi.__nav._jspService(__nav.java
              :254)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              pl.java:265)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              pl.java:200)
              at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispat
              cherImpl.java:241)
              at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112
              at weblogic.management.console.actions.ForwardAction.perform(ForwardActi
              on.java:35)
              at weblogic.management.console.actions.internal.ActionServlet.doAction(A
              ctionServlet.java:171)
              at weblogic.management.console.actions.internal.ActionServlet.doGet(Acti
              onServlet.java:91)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              pl.java:265)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              pl.java:200)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
              rvletContext.java:2495)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
              pl.java:2204)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              

    Might sound funny but try adding the connectors compiled classes (or the
              jar) in to WLS's classpath...
              I has a similar problem...
              "Chris R" <[email protected]> wrote in message
              news:[email protected]...
              >
              > Problem Statement: WLS6.1 SP2 on NT 4.0
              > ** Single WLS Admin Server - NOT CLUSTERED****
              >
              > 1. Deployed Resource Adpater at JNDI IICF.
              > 2. ManagedConnectionFactoryCreated.
              > 3. Trying to Undeploy - Generates following errors.
              >
              > After effects:
              >
              > View JNDI has (access denied). Is JNDI corrput now?
              >
              > The IiConnectionFactory is completely serializable. All members are String
              or
              > primitive int types. Only one transient member of PrintWrite.
              >
              >
              > Weblogic Log:
              >
              > IiManagedConnectionFactory::createConnectionFactory(?):1
              > Skipping over incompatible object at name=IICF,
              className=IiConnectionFactory
              > javax.naming.CommunicationException. Root exception is
              java.rmi.UnmarshalExcept
              > ion: failed to unmarshal interface javax.naming.NamingEnumeration; nested
              except
              > ion is:
              > java.lang.ClassNotFoundException: IiConnectionFactory: This error
              could
              > indicate that a component was deployed on a cl
              > uster member but not other members of that cluster. Make sure that any
              component
              > deployed on a server that is part of a cluster is also deployed on all
              other
              > me
              > mbers of that cluster
              > java.lang.ClassNotFoundException: IiConnectionFactory: This error could
              indicate
              > that a component was deployed on a cluster me
              > mber but not other members of that cluster. Make sure that any component
              deploye
              > d on a server that is part of a cluster is also deployed on all other
              members
              > of
              > that cluster
              > at
              weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:16
              > 2)
              > at
              weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:10
              > 6)
              > at
              weblogic.common.internal.WLObjectInputStream.resolveClass(WLObjectInp
              > utStream.java:49)
              > at
              java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
              > :918)
              > at
              java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
              > at
              java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
              > at
              java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
              > at
              java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
              > at
              java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
              > at
              weblogic.jndi.internal.BindingEnumeration.readExternal(BindingEnumera
              > tion.java:65)
              > at
              java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1212)
              > at
              java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
              > at
              java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
              > at
              weblogic.rmi.internal.CBVInputStream.readObjectInternal(CBVInputStrea
              > m.java:191)
              > at
              weblogic.rmi.internal.CBVInputStream.readObject(CBVInputStream.java:1
              > 82)
              > at
              weblogic.rmi.internal.CBVInputStream.readObject(CBVInputStream.java:1
              > 69)
              > at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
              > at
              weblogic.rmi.internal.BasicRemoteRef.unmarshalReturn(BasicRemoteRef.j
              > ava:232)
              > at
              weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
              > ef.java:263)
              > at
              weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
              > ef.java:229)
              > at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
              > at $Proxy49.listBindings(Unknown Source)
              > at
              weblogic.jndi.internal.WLContextImpl.listBindings(WLContextImpl.java:
              > 309)
              > at
              javax.naming.InitialContext.listBindings(InitialContext.java:399)
              > at
              weblogic.management.console.webapp._jndi.__nav.printContext(__nav.jav
              > a:116)
              > at
              weblogic.management.console.webapp._jndi.__nav._jspService(__nav.java
              > :254)
              > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              > at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              > pl.java:265)
              > at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              > pl.java:200)
              > at
              weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispat
              > cherImpl.java:241)
              > at
              weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112
              > )
              > at
              weblogic.management.console.actions.ForwardAction.perform(ForwardActi
              > on.java:35)
              > at
              weblogic.management.console.actions.internal.ActionServlet.doAction(A
              > ctionServlet.java:171)
              > at
              weblogic.management.console.actions.internal.ActionServlet.doGet(Acti
              > onServlet.java:91)
              > at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
              > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              > at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              > pl.java:265)
              > at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              > pl.java:200)
              > at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
              > rvletContext.java:2495)
              > at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
              > pl.java:2204)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              

  • How do I remove the grid map over an object when working in 3D?

    I am working through Adobe's Photoshop CS6 Classroom in a Book, Section 12 - Working with 3D Images.
    So far I have found it all fairly straight forward and very useful.
    I am at a point where I am applying textures and materials to my objects, however I cannot seem to find out how to remove the grid that has mapped itself over the objects. I have included a image to illustrate.
    Can anyone help?
    What is the command that will hide these grid maps?!
    Thanks so much in advance.

    I went into YouTube as well, and indeed: It didn't remove the white background.
    Then I went into Photoshop and was surprised: It was able to remove the white background by just playing around with the Magic Wand Tool. I also went into other programmes similar to Photoshop and was excited that there were connatural ways to remove the white background. Finally, I went into Illustrator and observed that the clipping path route worked. Even in CS6.
    Not sure why it didn't work for you.

  • Create Project Web App Instance - Failed to find Project Site object. Are there any database mounted?

    Hi
    New Installation. Sharepoint 2013, Project Server 2013 and SQL Server 2008 SP1 (another box).
    When I try to create Project Web App Instance, I get 
    Provisioning 'PWA': Post provisioning setup failed. Exception 'Microsoft.SharePoint.SPException: Failed to find Project Site object. Are there any database mounted?
     Followed by:
    Failed to provision site PWA with error: Microsoft.SharePoint.SPException: Failed to find Project Site object. Are there any database mounted?
    Already tried reinstalling the whole farm to no avail. Farm Admin account is used to do everything within this process.
    Thanks in anticipation.

    Hi
    I got the same error when provisioning the PWA
    Log Name:      Application
    Source:        Microsoft-SharePoint Products-Project Server
    Date:          8/29/2013 11:58:12 AM
    Event ID:      6966
    Task Category: Provisioning
    Level:         Error
    Keywords:     
    User:          abc\administrator
    Computer:      mycomputer
    Description:
    Provisioning 'PWA': Post provisioning setup failed. Exception 'Microsoft.SharePoint.SPException: Failed to find Project Site object. Are there any database mounted?
       at Microsoft.Office.Project.Server.Administration.ProvisionFeatureEventHandler.FeatureActivated(SPFeatureReceiverProperties properties)
       at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)
       at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean fForce)
       at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly)
       at Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, Int32 compatibilityLevel, String featureName, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean
    fMarkOnly, SPFeatureDefinitionScope featdefScope)
       at Microsoft.SharePoint.SPFeatureCollection.AddInternal(Guid featureId, Version version, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly, SPFeatureDefinitionScope featdefScope)
       at Microsoft.SharePoint.SPFeatureCollection.Add(Guid featureId)
       at Microsoft.Office.Project.Server.Administration.PsiServiceApplication.EnsureProvisioningFeature(SPSite site)
       at Microsoft.Office.Project.Server.Administration.PsiServiceApplication.CreateSite(ProjectProvisionSettings provset)'.
    Later found that the service application where I was trying to provision the PWA, it was not associated with the web-application.

  • Firefox 4 isn't turning the cursor to pointer mode when it goes over an object in a flash movie that has the 'buttonMode' property set to 'true'. Can this be fixed?

    I make flash games for a living, and normally when I set something to 'buttonMode' inside Flash, the cursor turns into the pointer when it rolls over the object. This is how it was in the previous version of FF and how it is in Safari and IE.
    But this isn't happening in FF4. The cursor is not turning into the pointer. Kind of a bummer. This is a tool so that the kids who play the games I make know when something is clickable.

    It seems to be an issue, I just posted the same question. I hope they fix it, its a bit annoying. I wonder if they had ex-Microsoft employees working on the updates for 4.0?

  • Invalid casts - Object and Integer

    OK, I have got myself confused with casts. I have written this code, which I have [bold]SUBMITTED[bold] to University (so if you change it you are not helping me cheat...) . It doesn't compile and I am out of ideas why. The problem is the last method returnEvenNumbers(). Please could someone help me learn how this should be used by turning this into running code.
    * Filename: RandomNumberArray.java
    * Author: Steven Lane
    * Email: [email protected]
    * Created on 17 February 2002, 17:53
    * Course: KIT eLearning, MSc in IT, University of Liverpool, UK
    *         MSC-JV0020110-03
    * Purpose: This class creates an uncostrained array of length L passed as int on instantiation.
    *          The array is populated with (pseudo) random numbers.
    *          Methods contain a filter for even numbers, which is pushed onto a stack.
    * Version: 0.2
    //package com.thinkcorporation.week6;
    // ------------------- Import Packages -------------------
    import java.util.*;
    // ------------------- Class Heading -------------------
    public class RandomNumberArray extends java.lang.Object {
        // ------------------- Field Defintions -------------------
       private Stack stkEvenNumbers = new Stack();
        private int [] rndNoArray;
        //private int [] evenNoArray;
        private Integer evenNoArray[];
        // ------------------- Constructors -----------------------
        public RandomNumberArray(int length) {
            rndNoArray = new int [length];
            populateRndNoArray();
        //------------------- Methods -----------------------------
        private void populateRndNoArray() {
            Random rnd = new Random();
            for(int counter = 0; counter < rndNoArray.length; counter++) {
                rndNoArray[counter] = rnd.nextInt();
        public void evenNumberFilter() {
            for(int counter = 0; counter < rndNoArray.length; counter++) {
                if (rndNoArray[counter]%2 == 0)
                    stkEvenNumbers.push(new Integer(rndNoArray[counter]));
        public int [] returnEvenNumbers() {
            if (!stkEvenNumbers.empty()) {
                evenNoArray = new Integer [stkEvenNumbers.size()];
                evenNoArray = (Integer)stkEvenNumbers.toArray();
            return evenNoArray;
    }You help is much appreciated.

    The root of the problem is a difference between primitive types and objects. The Stack.toArray() method returns an array of Objects (Object[]), which you can cast to an array of Integer objects (Integer[]):
    evenNoArray = (Integer[])stkEvenNumbers.toArray();However, your return type for that method is int[] - a primitive types, not objects. Meaning that you either have to step through the array and build an array of ints (using Integer.intValue()), or you have to change the return type of your method.

  • External Microsoft USB Mouse "slows" over clickable objects

    I've just gotten around to plugging in a wireless USB mouse from Microsoft into my iBook. Everything is fine except that when I turn sensitivity to the highest setting (the way I like it and have it set on my touchpad), the cursor slows down over clickable objects.
    Is there a way around this? The touchpad doesn't have this problem.
    Thanks,
    James

    Thanks for the feedback and sharing the comments from Apple. That kind of information helps other users!
    Some other things you can try.
    Uninstall the LCC using the original installer.
    Then do a manual search of the Library files and delete plist files showing Logitech or LCC in the file name. (Find and Spotlight do not search the libraries by default so you'll need to navigate to the User and System libraries manually before doing the search.)
    I used to have a Logitech track ball and I did notice that the LCC software sometimes did odd things I didn't like. After uninstalling the LCC and the plist files, the trackball worked just fine with the default Apple drivers.
    The one sure way to get rid of the LCC drivers is to do an Erase and Install of the OS - It is a lot of work....
    Short of a full Erase and Install, after manually removing the LCC drivers and plists, you can download and run the 10.5.5 Combo updater which may (or may not) correct faulty driver issues.
    http://support.apple.com/downloads/MacOS_X_10_5_5_ComboUpdate
    Hope that helps.

Maybe you are looking for

  • How to register new iphone on exisitng itunes account

    I replaced my old iphone with a new iphone and cannot register it with my existing itunes account.  I discovered this when I noticed that my calendars weren't syncing.  Do I need to open a new itunes account or can I change the device/iphone in my ex

  • Error While loading the data into PSA

    Hi Experts,        I have already loaded the data into my cube. But it doesn't have values for some fields. So again i modified the data in the flat file and tried to load them into PSA. But while starting the Info Package, I got an error saying that

  • Dunning - grouping of items disregarding company codes

    Hi all, I have set up dunning procedure and the client has more that one company code. Each company code has items posted to it. The problem is that a dunning notice is printed out for every company code and they want all items that are dunned to be

  • SRM 7.0 BADI Define Agents-- How to use type /sapsrm/t_wf_area_entity

    Hi Experts, I'm using SRM 7.0. When implementing BADI /SAPSRM/BADI_DET_AG (Define the agents of  procsess controlled workflow), I created the sub-class of interface /SAPSRM/IF_WF_AREA to develop my won logic in method GET_RESPONSIBLE_APPROVERS. I wan

  • Trying to parse a huge XML file

    I'm trying to parse a large (~200 Meg) XML file. I get out of memory errors with DOM, and so far using SAX has been a huge disaster. My program has to run on IE and Netscape as an applet. I've run into a HUGE amount of errors. While I have been doing