How to convert integer to object?

i want to use a Object array to store two integer variable
how can i do that?

Object[] my_array=new Object[2];
Integer int1=new Integer(7);
Integer int2=new Integer(42);
my_array[0]=int1;
my_array[1]=int2;- Marcus

Similar Messages

  • How to charge integer to object

    hi:
    the program just like below, the Fast and Slow is define by meself.
    public class Fast {
    private Vector vecArr = new Vector();
    public void push(Object elem){
    vecArr.addElement(elem);
    Fast sortFast=new Fast();
    Slow sortSlow=new Slow();
    public void test(){
    for(int i=32;i<=1024;i=i+i){
    for(int j=i;j>=1;j++){
    sortFast.push(j);
    sortSlow.push(j);
    my program alway stop at sortFast.push(j);
    the compile error is
    "cannot resolve symbol
    symbol : method push (int)
    location: class Fast
    sortFast.push(j);
    ^
    does somebody know how to change integer to object?
    Thanks a lot!

    here is how:
    int mySimpleInt = 5;
    Integer myIntegerObject = new Integer(mySimpleInt);

  • [b]How to convert a Socket object in a C socket file descriptor[/b]

    Hi all,
    I need to make a getsockopt() call using JNI, but I don't know how to convert a Java Socket object in the integer corresponding to the socket file descriptor.
    Thank you in advance!
    Fernando

    I was wrong in my previous post. FileDescriptor is used for PlainSocketImpl. This means I can give you a solution.
    The solution does involve rebuilding some built-in Java classes to make certain fields accessible.
    You have to modify access to three classes:
    1. You can either use my SocketGetImpl or just rebuild java.net.Socket and change from
    SocketImpl getImpl() throws SocketException {
    to
    public SocketImpl getImpl() throws SocketException {
    2. In java.net.SocketImpl change from
    protected FileDescriptor getFileDescriptor() {
    to
    public FileDescriptor getFileDescriptor() {
    3. In java.io.FileDescriptor I would add the method
    public int getFd(){ return fd; }
    Then my test program becomes:
    package myhack;
    import java.io.*;
    import java.net.*;
    public class DoSock {
            public static void main(String args[]) throws Exception{
                    Socket s= new Socket("mywebserver",80);
                    System.out.println("s="+s);
                    SocketImpl si = SocketGetImpl.getImpl(s);
                    System.out.println("si="+si);
                    FileDescriptor fd = si.getFileDescriptor();
                    System.out.println("fd="+fd);
                    System.out.println("fd int="+fd.getFd());
    }And you still have to invoke as:
    java -Xbootclasspath/p:. myhack.DoSock
    or boot path pointing at jar file, etc.

  • How to convert a Image object to byte Array?

    Who can tell me, how to convert Image object to byte Array?
    Example:
    public byte[] convertImage(Image img) {
    byte[] b = new byte...........
    return b;

    Hello,
    any way would suit me, I just need a way to convert Image or BufferedImage to a byte[], so that I can save them. Actually I need to save both jpg and gif files without using any 3rd party classes. Please help me out.
    thanx and best wishes

  • How to convert a Graphics object into a JPG image?

    I have this simple question about how to make a Graphics object into a JPG file...
    I just need the names of the classes or the packages ... I'll figure out the rest of the details...
    Thanks...

    Anyway this might come in handy
    JPEGUtils.java
    ============
    * Created on Jun 22, 2005 by @author Tom Jacobs
    package tjacobs.jpeg;
    import java.awt.Image;
    import java.awt.image.BufferedImage;
    import java.awt.image.RenderedImage;
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.imageio.ImageIO;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGEncodeParam;
    import com.sun.image.codec.jpeg.JPEGImageDecoder;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    * Utilities for saving JPEGs and GIFs
    public class JPEGUtils {
         private JPEGUtils() {
              super();
         public static void saveJPEG(BufferedImage thumbImage, File file, double compression) throws IOException {
              BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
              saveJPEG(thumbImage, out, compression);
              out.flush();
              out.close();
         public static void saveJPEG(BufferedImage thumbImage, OutputStream out, double compression) throws IOException {
              JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
              JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(thumbImage);
              compression = Math.max(0, Math.min(compression, 100));
              param.setQuality((float)compression / 100.0f, false);
              encoder.setJPEGEncodeParam(param);
              encoder.encode(thumbImage);
         public static BufferedImage getJPEG(InputStream in) throws IOException {
              try {
                   JPEGImageDecoder decode = JPEGCodec.createJPEGDecoder(in);
                   BufferedImage im = decode.decodeAsBufferedImage();
                   return im;
              } finally {
                   in.close();
         public static BufferedImage getJPEG(File f) throws IOException {
              InputStream in = new BufferedInputStream(new FileInputStream(f));
              return getJPEG(in);
         public static void saveGif(RenderedImage image, File f) throws IOException {
              saveGif(image, new FileOutputStream(f));
         public static void saveGif(RenderedImage image, OutputStream out) throws IOException {
    //          Last time I checked, the J2SE 1.4.2 shipped with readers for gif, jpeg and png, but writers only for jpeg and png. If you haven't downloaded the whole JAI, and you want a writer for gif (as well as readers and writers for several other formats) download:
    //          http://java.sun.com/products/java-media/jai/downloads/download-iio.html
              ImageIO.write(image, "gif", out);
         public static void main(String[] args) {
              // TODO Auto-generated method stub
    }

  • How to convert integer to string?

    for example :
    int num = 1;
    String num_str;
    how to convert the value of num variable to string .

    have u ever checked the documentation of WTK
    one method called valueOf
    will help u
    alpesh

  • How to convert PL/SQL Objects to XMLTYPE and use external schema

    We are creating PL/SQL Objects using Jpublisher to set values.
    We need to build a SOAP request based on that to call Web Service using utl_DBWS/UTL_HTTP.
    l_RequestHeader := OBJ_RequestHeader(l_UserObj,l_SourceDet,
    l_ReqHeaderId);
    XMLTYPE or CreateXML – both take schema(namespace) argument.
    For example
    reqhead := XMLType(l_RequestHeader,
    'Schema URL');
    We need converted XML in following format:-
    <proc:RequestHeader>
    <id>Id</id>
    <source>sr1</source>
    <user>
    <credentials>pass</credentials>
    <userID>user</userID>
    </user>
    </proc:RequestHeader>
    But after running XMLType, we are getting like this.
    <OBJ_REQUESTHEADER><USER_><USERID_>user</USERID_>
    <CREDENTIALS_>pass</CREDENTIALS_></USER_>
    <SOURCE_>sr1</SOURCE_>
    <ID_>Id</ID_></OBJ_REQUESTHEADER>
    XML tags are as per Oracle PL/SQL Wrapper and they are not matching with the request.
    Please let us know what is the problem here and any syntax/method to rectify this problem.

    "I have created few non cache tables in TT, to compile PL/SQL objects .
    if i make any DML's through PL/SQL(passthrough 1) , it is updationg with TT tables but not Oracle table ."
    [T2C]: This is correct and it is what you want to do, right?
    what is the way to handle non cahe tables updates through PL/SQL, how can we achive non cahe tables updates in TT ,refresh with oracle ( i.e non cahe table updates need to go to the oracle ).
    [T2C]: Sorry, but I am not sure I understand. Were you not able to update the non-cached tables, like you mentioned in the first paragraph? Do you mean that you want the non-cached tables to propagate to Oracle? Would that not be a cache table then?

  • How to convert  a date object to gregorianCalendar

    hi,
    I need to convert Date object to a gregorian calendar object. Can anyone tell me how to do that?
    thanx

    GregorianCalendar gc = new GregorianCalendar();
    gc.setGregorianChange(new Date(Long.MIN_VALUE))
    gc.setTime(new Date());

  • How to convert from Finder Object reference to POSIX path

    I'm new to AppleScript. I'm super close to getting what I need done, but I've ran across a snag in the middle.
    The error I'm getting is Can’t make quoted form of POSIX path of item 1 of {«class docf» \"filename\" of «class cfol» \"foldername\" of «class cfol» \"Desktop\" of «class cfol» \"Username\" of «class cfol» \"Users\" of «class sdsk» of application \"Finder\"} into type Unicode text. the problem area is highlighted and notated below. I've looked all around online but can't find what I need.
    Thanks in advance for any and all help!
    set text item delimiters to "."
    tell application "Finder"
      set theFilestoChoose to every item of (choose file with prompt "Please select the file(s) you would like to move and rename" with multiple selections allowed) as list
      display dialog "Would you like to move these files to an existing folder and then rename them, or create a new folder and then rename them?" buttons {"Move to an existing folder and rename", "Create a new folder and rename"}
      if result = {button returned:"Move to an existing folder and rename"} then
      set firstnewname to "Aauuttoommaattoorr"
      repeat with index from 1 to the count of theFilestoChoose
      set theFilesChosenbeingrenamedfirsttime to item index of theFilestoChoose
      set filenamecount to text items of (get name of theFilesChosenbeingrenamedfirsttime)
      if number of filenamecount is 1 then
      set fileextension to ""
      else
      set fileextension to "." & item -1 of filenamecount
      end if
      set the name of theFilesChosenbeingrenamedfirsttime to firstnewname & index & fileextension as string
      end repeat
      log theFilesChosenbeingrenamedfirsttime
      set choosingtheplacetomove to choose folder with prompt "Select the folder to move to"
      set thechosenfoldersname to name of folder choosingtheplacetomove -- sets the folder name as text
      set AppleScript's text item delimiters to {"-"}
      set Numberofthemonthatthebeginningofthefoldername to text item 1 of thechosenfoldersname as string -- for later to append the number back on without having to ask again!
      set shortenedname to text item 2 of thechosenfoldersname as string
      set the name of choosingtheplacetomove to shortenedname as string
      set thefolderstemporarynameaslocation to choosingtheplacetomove as string
      move theFilestoChoose to folder thefolderstemporarynameaslocation
      log theFilestoChoose
      set allfilesindestinationfolder to every file in choosingtheplacetomove as alias list --
      set aInitials to the text returned of (display dialog "Whose camera were this/these pictures taken on?" default answer "")
      set filteredList to my filterList(allfilesindestinationfolder, aInitials) as list
      log filteredList
      -- everything above this is correct so far and works perfect
      --TROUBLE SECTION BELOW
      set theSortedfilterList to (sort filteredList by creation date) -- something happens here with the theSortedfilterList that makes it unintelligible to convert to POSIX later. but I need the files in the order that this line puts them.
      log theSortedfilterList
      set timetorenamelasttime to theSortedfilterList
      set newbasename to shortenedname
      repeat with index from 1 to the count of timetorenamelasttime
      set theonefile to item index of timetorenamelasttime
      set theonefilenamecount to text items of (get name of theonetwothreefile)
      if number of theonefilenamecount is 1 then
      set fileextensionone to ""
      else
      set fileextensionone to "." & item -1 of theonefilenamecount
      end if
      tell application "System Events" to set CreaDate to creation date of file theonefile
      set CreaDate2 to CreaDate as text -- need to trim down to the first 10 characters and eliminate the "-"
      set AppleScript's text item delimiters to {""}
      set shorteneddatename to text items 1 thru 10 of CreaDate2 as string
      set the name of theonefile to shorteneddatename & {"-"} & newbasename & {"-"} & aInitials & {"-"} & index & fileextensionone as string
      end repeat
      --Trouble section above
      set the name of choosingtheplacetomove to Numberofthemonthatthebeginningofthefoldername & "-" & shortenedname as string -- returns the month prefix to the foldername
      else if result = {button returned:"Create a new folder and rename"} then
      set repeatConfirmation to true --Boolean to decided if script should be repeated; default is to repeat
      repeat while (repeatConfirmation = true) --Repeat if Any Tests Are Failed
      set thefirstquestion to choose from list {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} with title "Event Month Selection" with prompt "Select the month in which the event started. Select only one month:"
      set theMonthAnswer to result
      if theMonthAnswer = false then --"For historical reasons, choose from list is the only dialog command that returns a result (false) instead of signaling an error when the user presses the “Cancel” button."
      set repeatConfirmation to false
      set exitingeventmonth to display dialog ("You are exiting selecting the event month phase of the program. You will need to manually fix this decision") buttons {"OK"} with title "Exiting Event Month Selection"
      if button returned of exitingeventmonth = "OK" then
      set theMonthAnswer to ""
      end if
      else
      set confirmationanswer to display dialog "You selected " & theMonthAnswer & ", is this correct? " buttons {"Yes, that's correct.", "No, the picture(s) are from a different month."} with title "Confirm Event Month Selection"
      if button returned of confirmationanswer = "Yes, that's correct." then
      set repeatConfirmation to false
      else
      display dialog ("That's okay, you can select another again!") buttons {"OK"} with title "Return to Event Month Selection"
      end if
      end if
      end repeat
      log theMonthAnswer
      if theMonthAnswer = "" then
      set monthtonumber to "You have cancelled this action."
      log monthtonumber
      else if theMonthAnswer = {"January"} then
      set monthtonumber to "01"
      log monthtonumber
      else if theMonthAnswer = {"February"} then
      set monthtonumber to "02"
      log monthtonumber
      else if theMonthAnswer = {"March"} then
      set monthtonumber to "03"
      log monthtonumber
      else if theMonthAnswer = {"April"} then
      set monthtonumber to "04"
      log monthtonumber
      else if theMonthAnswer = {"May"} then
      set monthtonumber to "05"
      log monthtonumber
      else if theMonthAnswer = {"June"} then
      set monthtonumber to "06"
      log monthtonumber
      else if theMonthAnswer = {"July"} then
      set monthtonumber to "07"
      log monthtonumber
      else if theMonthAnswer = {"August"} then
      set monthtonumber to "08"
      log monthtonumber
      else if theMonthAnswer = {"September"} then
      set monthtonumber to "09"
      log monthtonumber
      else if theMonthAnswer = {"October"} then
      set monthtonumber to "10"
      log monthtonumber
      else if theMonthAnswer = {"November"} then
      set monthtonumber to "11"
      log monthtonumber
      else if theMonthAnswer = {"December"} then
      set monthtonumber to "12"
      log monthtonumber
      end if
      set theNameofFoldertoMake to text returned of (display dialog "Please enter the name of the new folder you are creating:" default answer "" with title "New Folder Name")
      set LocationOfNewFolder to choose folder with prompt "Choose the location of the new folder you are creating:"
      set theNewNameofFoldertoMake to monthtonumber & "-" & theNameofFoldertoMake
      set newfolderaction to make new folder at LocationOfNewFolder with properties {name:theNewNameofFoldertoMake}
      move theFilestoChoose to newfolderaction
      end if
    end tell
    --function
    on filterList(allfilesindestinationfolder, aInitials)
      set patterns to {aInitials as string, "Aauuttoommaattoorr"}
      set output to {}
      repeat with aFile in the allfilesindestinationfolder
      repeat with aPattern in patterns
      set filepath to aFile as string
      if filepath contains aPattern then
      set end of the output to aFile
      exit repeat
      end if
      end repeat
      end repeat
      return output
    end filterList

    Okay, so you wanted the debugging and error messages. Thank you for the coaching. Here is what I get from the following line:
    set theSortedfilterList to (sort filteredList by creation date)
    log theSortedfilterList
    Log returns:
    (*document file Aauuttoommaattoorr3.AVI of folder SnowDay of folder Desktop of folder Username of folder Users of startup disk, document file Aauuttoommaattoorr2.MOV of folder SnowDay of folder Desktop of folder Username of folder Users of startup disk, document file Aauuttoommaattoorr1.mov of folder SnowDay of folder Desktop of folder Username of folder Users of startup disk*)
    set pxFile to POSIX path of ((theSortedfilterList) as alias)
    Error: "Can’t make {«class docf» \"Aauuttoommaattoorr3.AVI\" of «class cfol» \"SnowDay\" of «class cfol» \"Desktop\" of «class cfol» \"Username\" of «class cfol» \"Users\" of «class sdsk» of application \"Finder\", «class docf» \"Aauuttoommaattoorr2.MOV\" of «class cfol» \"SnowDay\" of «class cfol» \"Desktop\" of «class cfol» \" Username \" of «class cfol» \"Users\" of «class sdsk» of application \"Finder\", «class docf» \"Aauuttoommaattoorr1.mov\" of «class cfol» \"SnowDay\" of «class cfol» \"Desktop\" of «class cfol» \" Username \" of «class cfol» \"Users\" of «class sdsk» of application \"Finder\"} into type alias." number -1700 from {«class docf» "Aauuttoommaattoorr3.AVI" of «class cfol» "SnowDay" of «class cfol» "Desktop" of «class cfol» "Username" of «class cfol» "Users" of «class sdsk», «class docf» "Aauuttoommaattoorr2.MOV" of «class cfol» "SnowDay" of «class cfol» "Desktop" of «class cfol» "Username" of «class cfol» "Users" of «class sdsk», «class docf» "Aauuttoommaattoorr1.mov" of «class cfol» "SnowDay" of «class cfol» "Desktop" of «class cfol» "Username" of «class cfol» "Users" of «class sdsk»} to alias
    That is why I labeled it with Finder Object reference won’t return POSIX path, because I tried what was suggested about using the POSIX path of line. I thought seeing the lines above and around it would help set the context.
    So I need those files, but I need them sorted by creation date so that they’re in that order for the next renaming step.

  • How to convert Oracle Collection(Objects) to XML dynamically?

    Dear members,
    As a requirement I need to pass the collection of values(typically a object or a table type) to a procedure and generate a XML file on the fly basing on these collection values.I am not sure how to do it.Can anyone please guide me on that?
    Thanks

    Hi,
    depending on how often/how complex the programming job is:
    --- complex Xml structure, lots of changes: Have a look at [Oracle XML DB Developers Guide|http://download-west.oracle.com/docs/cd/B28359_01/appdev.111/b28369/toc.htm], chapter 3: Using Oracle XML DB
    --- simple:
    Here's a quick sample for generating Xml from SQL collection types. Works (at least) >= 10g.
    create type xxp_foo_type as object (
    a number
    instantiable
    create type xxp_foo_tab as table of xxp_foo_type
    declare
    v_table xxp_foo_tab := xxp_foo_tab();
    v_xml xmltype;
    begin
    v_table.extend(2);
    v_table(1) := xxp_foo_type( 1 );
    v_table(2) := xxp_foo_type( 2 );
    select xmlelement( "MyXml",
    xmlagg(
    xmlelement( "SomeValue", t.a )
    into v_xml
    from table( v_table ) t
    dbms_output.put_line( v_xml.getStringVal() );
    end;

  • How to Convert Integer to byte[n]!Help

    I have a Integer 314,Convert to hex is 0x13a,I want to convert to byte[2],and byte[0] equals 0x13 and byte[1] equals [0x30];I use this method convert byte[4],
    int iVal = 314;
    byte [] bVals = new byte[4];for( int i=0; i<4; i++ ) { 
    bVals<i> = (byte)(iVal & 255);
    iVal >>= 8;
    Not I want to result.Please help!

    Try:
    int iVal = 0x01FF03F0;
    byte [] bVals = new byte[4];
    for(int i=3; i>=0; i--) {
        bVals[i] = (byte)(iVal & 255);
        iVal >>= 8
    //print results
    for (int i = 0; i < 4; i++) {
       int temp = bVals[i] & 0xFF;  // avoid displaying negative numbers
       System.out.println("byte " + i + " = " +  Integer.toHexString(temp));
    }

  • How to convert a text object to a Group?

    There are some text object present on Adobe Illustrator document. Each text object is required to convert in individual group, so that some entities can be inserted under those objects turned groups.
    In the APIs available with AI SDK, there can not be found an API to have the conversion directly. There is a provision of 'ReleaseToLayer' but it will not serve the purpose.
    Will it be possible to have such coversion?
    OR
    It will also do, if a Group is created and the text object is able to be moved under the Group.
    Is there any API to create a 'Group' ?

    I'm not quite following what you're trying to do exactly, but I'm sure there's a way to do it.
    You can create a group using the AIArtSuite (NewArt). You can iterate through a text object using the objects found in IText.hpp. You can load an IText object using the functions in AITextFrame.h (usually GetATETextRange). If you're trying to break up parts of text into separate groups, you'll have to do that manually using these APIs. If that's not what you're trying to do, I'm afraid I'm just not understanding your explanation; maybe you can try and clarify it.

  • Plz Help!!! Have to  convert an paint object to image

    Hi.I am new to Jave and am developing an application
    which has to send painted shapes(using SWING) to a mail id.
    I think it can be done in two steps
    1) Converting the paint objects to images.
    2} sending the image
    However I don't have a clue regarding the first step
    and have only a rough idea about the 2nd.
    Please suggest a solution.
    Thanks

    hi,
    you can try using the Robot call and calling the screencapture method, giving the the correct parameter values should allow it to get the image you want only, this will return a BufferedImage object, you can search the forums on how to convert a BufferedImage object to an image there are plently of examples floating around.

  • SSRS Convert Integer to Date

    Does anyone know how to convert integer to date in SSRS Report?
    The integer is in this format: 20140404
    Thank you.

    Is it a parameter?
    Is it a report result set?? Please post complete details.
    With less info I assume that is not a interger, It is just a different date format. See below
    Date Patterns
    if it is a real integer, sample
    Declare @test int=20140404
    SELECT cast (convert (varchar(8),@test) as date)
    - please mark correct answers

  • How to convert form Integer to Object

    How do I a convert from Integer to Object?

    ZIP codes are not integers because one does no
    arithmetic with them.Sure they do. Look at this zip code:
    90210-0001
    Looks like subtract 1 from 90210 to me. <joking/>Well US zip codes yes but Canadian zip codes are
    alpha numericbase 36 you mean.

Maybe you are looking for