Example from Angelica Langer FAQ - need help

Hi everyone,
I found this example in the FAQ:
interface Acceptor<V> {
  void accept( Task<V> task, V v);
interface Task<U> {
  void go(Acceptor<? super U> acceptor);
class AcceptingTask<U> implements Task<U> {
  public void go(Acceptor<? super U> acceptor) {
    U result = null;
    ... produce result ...
    acceptor.accept(this, result);  // error
} And explanation for this:
"The argument of type U is fine because the declared argument type is an unknown
supertype of U . But the argument of type AcceptingTask<U> is a problem. The declared
argument type is an instantiation of Task for an unknown supertype of U . The compiler
does not know which supertype and therefor rejects all argument types. "
I have to admit that I am totally lost here. For me, calling accept method which takes
AcceptingTask<U> and U is fine :/ AcceptingTask is a Tak and U is a super type of
? super U. Could someone with a lot of patience to unteachable people could
explain it to me please ? ;)
Thanks,
Adrian

Here's a more concrete example:
public class Test
   public static void main(String[] args)
      AcceptingTask task = new AcceptingTask();
      Integer zero = Integer.valueOf(0);
      new NumberAcceptor().accept(task, zero);
interface Acceptor<V> {
  void accept( Task<V> task, V v);
interface Task<U> {
  void go(Acceptor<? super U> acceptor);
class AcceptingTask implements Task<Integer> {
  public void go(Acceptor<? super Integer> acceptor)
class NumberAcceptor implements Acceptor<Number>
   public void accept(Task<Number> task, Number n)
}So in the above the error is:
accept(Task<java.lang.Number>,java.lang.Number) in NumberAcceptor cannot be applied to (AcceptingTask,java.lang.Integer)
In other words, you can't pass a Task<Integer> to something that requires a Task<Number>.
So working back to the original code, the passed in Acceptor is Acceptor<? super U> which means that it's an acceptor of any valid super type of U. More specifically no matter what type U is, you can aalways pass in an Acceptor<Object>. If you had an AcceptingTask<String> you cannot use this as a Task<Object>.
The explanation, at least the part you quote isn't that great. It's isn't that the compiler doesn't know what the super type is, it's that it does know that a valid Acceptor (e.g. Accpetor<Object>) could be incompatible with the Task.

Similar Messages

  • HT3775 I get the following message when trying to open an .avi downloaded from my video cam, need help, can not find the codec, thank you.The document "IMAG0026.AVI" could not be opened. A required codec isn't available.

    I get the following message when trying to open an .avi downloaded from my video cam, need help, can not find the codec, thank you. This is for Quicktime Player.
    "The document “IMAG0026.AVI” could not be opened. A required codec isn't available."

    Try Perian.
    http://perian.org/

  • HT203167 I look at my history of purchases including my songs and ringtones from iTunes. They are all there but my ringtones say I have to purchase them again in order to put them on my new iPhone that I just purchased from Rogers. I need help getting my

    I'm trying to get my ringtones that i purchased on my old iPhone onto my new one that I just got. They r in my history and when I click on them it says you have already purchased them, would you like to buy them again in order to download them. I did it with one already and I now need help so I don't have to buy them again. Can u help get them back please

    Ringtones are currently a one-time only download from the store. If you don't have them on your computer nor on a backup then you can try contacting iTunes support and see if they will grant you a re-download : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • HT1420 this is the first time i'm about to use this computer to buy songs from itune n i need help

    i need help buying music from itune

    Podcast Producer is part of OSX server and is something I have no experience of. It is expecting your to be running your own server - AFAIK it's not designed for use when you are expecting to host on a commercially run server but I'm not sure about that. You should ask in the OS X Server forum applicable to the version you have. If you are not running OSX server then this program appears not to be suitable for you.

  • Error from using ANT program, need help, Thanks

    Hello,
    I tried to run J2ee tutorial sample code. Following the instruction, I tried to ues ant to build a sample ConverterAPP but get some error message. I would preciate if somebody could give me some help.
    Thanks.
    Hui Lu
    [email protected]
    Following is the command I entered from an CMD window and the exception I got:
    C:\j2sdkee1.3\j2eetutorial\examples\src>ant converter
    ***Warning: I am here start runAnt.
    Exception in thread "main" java.lang.NoClassDefFoundError: Connectors\classes;C:
    \javacode\classes;C:\eGate\client\classes;C:\eGate\client\classes\egate/jar;C:\eGate\client\JRE\1/1/7B\lib\rt/jar;C:\PROGRA~1\MQSeries\java\lib\COMIBM~2/JAR;C:\
    PROGRA~\MQSeries\java\lib\COMIBM~1/JAR;C:\PROGRA~\MQSeries\java\lib\COMIBM~3/JAR;C:\PROGRA~\MQSeries\tools\javaclnt\samples\en_us;
    Warning: I am here end runAnt.
    Following is the command line in the batch file which raised Exception
    C:\jdk1.3.1_01\bin\java -classpath "C:\jdk1.3.1_01\lib\tools.jar";"C:\j2sdkee1.3\jakarta-ant-1.3\lib\parser.jar";"C:\j2sdkee1.3\jakarta-ant-1.3\lib\jaxp.jar";"C:\j2sdkee1.3\jakarta-ant-1.3\lib\ant.jar";C:\javacode\classes;C:\j2sdkee1.3\jaka
    rta-ant-1.3\bin;C:\j2sdkee1.3\bin;C:\jdk1.3.1_01\bin;C:\IBMCON~\CICS\Classes\CTGCLI~1.JAR;C:\IBMConnectors\classes;C:\javacode\classes;C:\eGate\client\classes;C:\eGate\client\classes\egate.jar;C:\eGate\client\JRE\1.1.7B\lib\rt.jar;C:\PROGRA~\MQSeries\java\lib\COMIBM~2.JAR;C:\PROGRA~\MQSeries\java\lib\COMIBM~1.JAR;C:\PROGRA~\MQSeries\java\lib\COMIBM~3.JAR;C:\PROGRA~\MQSeries\tools\javaclnt\samples\en_us;
    -Dant.home="C:\j2sdkee1.3\jakarta-ant-1.3" org.apache.tools.ant.Ma
    in converter
    ****************************************

    Obviously you have the IBM java tools installed on your PC, and your classpath starts with IBM Connectors\...
    What you need to do is to edit your classpath environment variable in control panel->systems, and use quotation marks for any long directory/file names, or directory names with spaces in them. For example, change C:\IBM Connectors\classes to "C:\IBM Connectors\classes". Then it will work.

  • Audio tracks suddenly missing from capture... need help!

    Hi! I have been capturing video (with audio) successfully and routinely for months now. Suddenly, though, when I capture video... from the same device, with the same preset... the clips have only 1 Video track, and no Audio tracks. My camera is still recording audio (and I still hear it during the capture), but the audio tracks just aren't there in the resultant clip. It seems to me like FCE has just decided not to capture audio, as if to say "pffft... we don't need that." But why this happened is beyond me!
    Even within this same project, I have other clips captured with audio just fine. I didn't even realize it was an option NOT to capture audio. There aren't any settings to that effect in the Capture window... i.e. there's nothing to turn OFF, so I don't know how to turn it back ON! HELP! How do I get audio back on my captured clips? Is there a way to toggle this? How can I possibly be getting video without audio when the preset has already been working for this device?
    Things seemed to change once I started using the Voice Over tool. After that, none of my captured clips have audio. Something I did on or around that time changed FCE internally. I combed through the manual but didn't see any leads. They assume if you have the right preset, it'll just work. No mention of disabling audio.
    Please help, because I'm just about ready to throw my Mac throw the wall. I even tried reinstalling FCE, just to get it back to the previous state, but it didn't help.
    P.S. I also haven't changed anything on my camera that would affect audio. I feel this is just a setting somewhere in FCE that I can't find and don't even know where to look for it...
    Thanks in advance!!

    Hi. Where should I look for them? I haven't had much success finding things on my own, so please spell it out for me.
    I just find this so odd... it would be one thing for the tracks to be silent or garbled, then I would think this was a cable issue or the camera. But I can't even imagine why the audio tracks would just not be there. If I saw a preference for "Video Only Capture" somewhere, it would make sense.
    Anyway, thanks. Please tell me where there's a prefs file, and I'll roast it.

  • Connecting to an oracle db from a servlet.  need help.

    Hello!
    I'm a noob in webprogramming but I am studing it for a month. So I have a trouble with jdbc.
    I write a web application in Sun Studio Creator 2 IDE. There is an Oracle 11g database on my computer. The application has ajax jsp, which
    sends asynchronous requests to a servlet. The servlet must open jdbc connection, process the request and send back the data. I got a
    driver from oracle.com(ojdbc.jar) and import it to my project. But at first I thought to write a simple console program to connect jdbc. It
    works good.
    Here it is:
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.*;
    import oracle.sql.* ;
    import java.sql.* ;
    public class getdata {
    private static Connection conn;
    private static Statement stmt;
    private static ResultSet rset;
    public static void initConnection()
    try {   
    System.out.println(" ");
    System.out.print("Registering Oracle driver..........................");
    DriverManager.registerDriver ( new oracle.jdbc.driver.OracleDriver());
    System.out.println("Success");
    System.out.print("Establishing database connection...................");
    conn = DriverManager.getConnection("jdbc:oracle:thin:@Nobody:1521:glob", "sysman", "mypass" );
    System.out.println("Success");
    System.out.print("Creating statement object..........................");
    stmt = conn.createStatement();
    System.out.println("Success");
    catch (SQLException e)
    System.out.println("Failed!");
    System.out.println("Failure reason: " + e);
    public static void executeSQLQuery(String inSQL)
    try
    System.out.println("Trying to execute: \n" + inSQL);
    System.out.print("Executing SQL select query.........................");
    rset = stmt.executeQuery (inSQL);
    System.out.println("Success");
    System.out.println(" ");
    while (rset.next())
    System.out.println ("<cid>"+rset.getString(1)+"</cid>");
    System.out.println ("<oemnumber>"+rset.getString(2)+"</oemnumber>");
    System.out.println ("<rusdesc>"+rset.getString(3)+"</rusdesc>");
    System.out.println ("<engdesc>"+rset.getString(4)+"</engdesc>");
    System.out.println ("<unorignumber>"+rset.getString(5)+"</unorignumber>");
    System.out.println ("<system>"+rset.getString(6)+"</system>");
    rset.close();
    stmt.close();
    conn.close();
    catch (SQLException e)
    { System.out.println("Failed!");
    System.out.println("Failure reason: " + e);
    public static void main(String[] args) throws IOException
    initConnection();
    executeSQLQuery("SELECT * FROM parts go");
    Then I need to use this code in my servlet. But it stops on the string:
    conn = DriverManager.getConnection("jdbc:oracle:thin:@Nobody:1521:glob", "sysman", "mypass" );
    I don't know why. Can you help me? Thanks for any help. We have no forums qualified enough in our language. And this is my first
    message to an english speaking site, so excuse me for mistakes. I hope I can write this program before our university session will start :-)

    Sorry, yes.
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {
    try {   
    System.out.println(" ");
    System.out.print("Registering Oracle driver..........................");
    //DriverManager.registerDriver ( new oracle.jdbc.driver.OracleDriver());
    Class.forName("oracle.jdbc.driver.OracleDriver");
    System.out.println("Success");
    System.out.print("Establishing database connection...................");
    conn = DriverManager.getConnection("jdbc:oracle:thin:@Nobody:1521:glob", "sysman", "mypass" );
    System.out.println("Success");
    System.out.print("Creating statement object..........................");
    stmt = conn.createStatement();
    System.out.println("Success");
    catch (ClassNotFoundException a)
    catch (SQLException e)
    System.out.println("Failed!");
    System.out.println("Failure reason: " + e);
    }

  • I use a scxi 1530 module to acquire acceleration from an accelerometer and need help to write the integration to know the deplacement

    i would like to integrate the acceleration signal i receve from my accelerometer connected to my &("à MODULE SCXI TO KNOW THE DIFFERENT DEPLACEMENT OF MY SIGNAL;;NEED SOME HELP

    Debonfort,
    I'd like to ask a few questions for clarification.
    1. What programming language are you using?
    2. Are you looking for more programming assistance and calculations? Or getting data from the 1530?
    3. Which version of NI-DAQ are you using?
    4. What DAQ board are you connected to?
    I look forward to your responses. Perhaps other users will be able to help more too with your answers.

  • Ibook won't boot up on own or from OS installation CD (need help in Yemen)

    Hello,
    I'm currently in Yemen for a few months and my ibook seems to have died on me. The country isn't exactly brimming with Apple support technicians so any advice or suggestions people could give me would be really appreciated.
    I have an older ibook (dual USB G3 which I bought in June 2001). It has the occasional application or OS freezes, but typically restarting solves these. Yesterday, however, when I tried restarting the computer wouldn't boot up - it would get to the gray start up screen with the apple and spinning wheel and would just sit there with no progress even after an hour. I removed the airport card and extra RAM, but no luck.
    I ran the Apple Hardware Check CD, but everything came up clean. I also ran Norton Utilities Disk Warrier and it found Major Errors in some of the directories (I have the list at home if that would help) all of which it said it fixed. However, it wasn't able to complete checking the HD, at one point it tried to find some files and never was able to get any further in the check - it would just sit for hours with no progress. When I tried rebooting the computer on its own it got no further than a gray screen.
    At this point I decided it might be easiest just to reinstall the opperating system. I put in the installation disks (OS 10.2.4) and tried booting up from the CD - the boot up was very slow and ultimately (maybe after 10 minutes) instead of a gray screen with an Apple logo it came up with the "forbidden symbol" (i.e. the circle with the slash through it that you see on no smoking signs).
    At this point I'm not quite sure what to since it isn't booting up from the installation CD - are there any other tricks I could try or reason why it won't boot up from the CD? I also have a copy of 10.4 installation CD but I'm hesitant to install it just because the ibook is such an old computer and it would require the extra RAM to run it (currently I have 300 something of RAM in the computer). I also have a 20 GB external harddrive with me if there's anyway I could boot up with it.
    Three years ago the laptop had major problems and basically died, but went into Apple and seemed to have been fixed and had the logic board replaced. After this point I got a new laptop (which I'm hiting myself for not bringing with me at this point) and haven't really used this computer frequently - maybe 5 to 10 times in the last 3 years, it really is a "spare" laptop. I used it for about a week before coming and it seemed to be working fine.
    At this point I'm really open to any suggestions on how to fix and jury rig it to work for the next 3 months (really I just need to be able to use Word and iPhoto) or so as I won't be using it once I get back to the States. Any suggestions or help would be greatly appreciate. Thank you very much!!

    Hi, and welcome to Apple Discussions.
    Which utility did you use on the iBook? Was it Norton DiskDoctor or Alsoft's DiskWarrior? They are two entirely different things.
    Norton DiskDoctor was developed for OS 9. It doesn't recognize OS X as a legitimate operating system, identifies OS X as "errors" on your drive, and sets about "fixing" those errors, really messing things up in the process. (It does this even if you run it in OS 9 on a drive that has OS X on it.)
    Apple calls the sign you are seeing when trying to boot from the CD a "prohibitory sign."
    Check out this Apple Knowledge Base article on what to do about a prohibitory sign at startup:
    http://docs.info.apple.com/article.html?artnum=106805
    Maybe something there will help.

  • I can't install apps from my apple store, need help

    Hi All, I have an iphone 3GS. I used to download free as well as purchased apps from the app store. For some reason I am not able to do that anymore. For example when I try to open my facebook app, it keeps on not opening it, last time it did that to me, I deleted it reinstalled it, but now I am stuck because I can not install anything from the app store. Pls help what it does it: I click on the app store, it will allow me to pick the app I want to install (e.g. facebook, then it gives me the option to download, i.e. 'Free' but the free is with a plus sign i.e. "+Free"  then when I click on it, the "Install" appears but partially like "insta..." then am stuck can't install or do anything, anyone with idea on how to resolve this?
    P.S. I have not upgraded to IOS 4
    I have tried to restart my phone so many times,
    I have logged out and re-logged into the app store on my iphone.
    thanks much

    Log out of the Apple ID on your iPhone.
    Reset your iPad by simultaneously pressing and holding the Home and Sleep/Wake buttons until you see the Apple Logo. This can take up to 15 seconds so be patient and don't release the buttons until the logo appears.
    Log back into to your Apple ID with the current password.

  • Trying to move songs from 1comp to another- NEED HELP

    I was orginally trying to move my itunes folder from my old comp to my new one. Easy enough right? Wrong. I copied the folder and put it on my 40gb ipod then went to put it on my comp. Well it only put bout 1/3 of my music like the first 15 folders. It started saying files were corrupt. Then I started getting the ! with the folder on my ipod. I tried reseting it but that doesn't work and it is fully charged. I'm using Windows XP. Plz help. I just sold my other laptop so I need to get these songs off the other computer.

    I have a similar problem, my hard disk has been reformatted and my library of songs is now only on the iPod, can i transfer them back from the iPod to the computer or is my library now only accessible on my iPod.

  • Pre Plus won't sync more than latest 3 months from Google Calendar. Need help.

    [previously posted in WebOS Software section, but I now think that might have been the wrong place; only one reply; no answers]
    I was a very happy owner of my new Pre Plus until I tried to sync my multi-year Google Calendar to my PP, when only the last three months of my GC data would sync to my PP.
    Some higher level Palm techs and I spent quite a lot of time on the phone, trouble shooting and testing. Ulltimately, we were unable to solve the problem. The last tech I spoke with acknowledged that currently there are performance problems with the PP if a lot of GC data is downloaded.  Apparently Palm has decided (for now) to prevent us new PP owners from choking our PP's performance by limiting our initial downloads to only the most recent three months of GC data. I was told that Palm is working on this problem and it probably would be fixed with the next update.
    I've searched the forum and didn't see any other mention of this problem.  Any one else experiencing this problem?
    *** My questions:  Can someone at Palm tell me (1) Is this is a problem that is being worked on by Palm/Verizon?  (2) If so, should be fixed soon? (I only have about 10 days left in my 30 day trial of the PP at Verizon. If I can't have all of my GC data on my phone I will have to turn it back in before the trial period ends.)  (3) Can you suggest some other trouble shooting I could try? (4) Can you suggest a workaround?
    (I can provide a somewhat comprehensive list of the trouble shooting already tried and my Service Request Number, if needed.)

    The time period for syncing calendar events is a setting.
    Go into Settings; Mail, Contacts, Calendars.
    Scroll down to you get to Calendars.  Where it says Sync, you have an option to change how long you want to sync.
    The Default is Events 1 Month Back, but you can choose All Events.

  • Can't access the web-site in my home folder from the internet.  Need help.

    I am trying to publish a website from the Sites folder in my home directory. The website is made and I can access it from from every computer within my ethernet. But despite a couple attempts I made I can not get the website published on the internet.
    I have an Airport Express station. Two Macs and one PC are using the ethernet. As far as I can tell the Airport Express station is directly connected to the internet. I live in a brand new apartment which has Lan outlets in every room next to the electricity outlets. I have a single designated internet IP address.
    To open my computer to the internet I set the "Default Host Option" in the Airport Administrator Utility and selected the default three digits for the "Default Host option" IP address. Then I updated the Airport Express station, manually set the IP address in the Network preferences on my Mac to the "Default Host option" IP address and activated Personal Web Sharing in the Sharing preferences. By doing so I lost my internet connection. It turned out I still had the same IP address that I had before I selected Default Host Option.
    As I understand with the Default Host Option I designate one IP address within the ethernet to receive all traffic from outside. But how do you now tell the Airport Express station which computer on the ethernet will be the host for the incoming traffic carrying the Default Host Option IP address? Apparently just setting the IP address manually in the clients computer Network preferences to the "Default Host Option" IP address doesn't tell the Airport Express station to change the IP address it has assigned to this client to the Default Host Option IP address.
    In another attempt to make my website accessible on the internet I removed the Default Host Option and instead opened Public Port 80 and Private Port 80 for the IP address of the client computer in the Port Mapping tap of the Airport Administrator Utility. But again, no access to my website from the internet.
    To access the website from within the ethernet I use the following web-link, which works fine:
    http://192.xxx.x.x/~user/index.html
    The internet of course doesn't see the 193 IP address. It only sees the Public IP address. Therefore I used the Public address instead of the Private IP address to connect to my website from the internet:
    http://222.xxx.xxx.xxx/~user/index.html
    But as I said, I still can't access the website from the internet.
    I have the feeling that I conceptually don't understand something correctly. I would appreciate if somebody could help me with this problem.

    See this article:
    http://support.apple.com/kb/HT1866
    Sometimes My Music does not show up in special folders in TweakUI.
    If so, see this post:
    http://discussions.apple.com/thread.jspa?messageID=1731188&#1731188##
    If you would rather not mess with the registry you can often work round with a shift key start.
    Hold down the shift key and start iTunes, keep holding down the shift key until you are asked to choose or create a library. If you already have one, navigate to your iTunes folder and choose iTunes Library.itl. Otherwise create a new library in My music.

  • NTSC to PAL (from 29fps to 25fps) need help

    Hey Folks,
    I read this post here: http://discussions.apple.com/thread.jspa?messageID=2675891
    And I wasn't able to reply to it since it was closed... so here's my situation. I shot a music video on my Sony TRV-19 camcorder @ 29fps (not positive if it's Progressive or Interlaced, though my guess is Interlaced) and the lable in Europe needs it in PAL @ 25fps... so what I'm doing now is converting it through compressor @ the PAL settings 720/576 25fps...
    Will I be able to view the PAL format on my computer? I'm in Canada now. What can I do to get that format to play properly in Europe, without any scanlines and loss of quality?
    Is anyone willing to help me out? Appreciate your type folks.
    my best
    -Joey

    I wouldn't recommend using Compressor. You might consider Nattress Standards Conversion.
    http://www.nattress.com/Products/standardsconversion/standardsconversion.htm

  • Conversion from Binary to decimal - Need help

    Hi guys,
    I am new here and learnt some very basic Java before. I have a program that is in C++(to convert a binary number to decimal) that I found in the internet that interest me a lot. I am thinking whether this can be re-write in Java. I have tried to searh for solution but to no avail. I am wondering whether you guys can suggest a solution to this. Below are the source code in C++ :
    #include <iostream.h>
    #include <stdlib.h>
    int main()
    // part 1 : declaration
    int Bin, Dec, TempBin;
    int div;
    char valid, again;
    do {
    // part 2 : Repeat asking the value of the binary number
    Bin = TempBin = 0;
    do {
    cout << "Please input a binary number (1 to 10 bits) : ";
    cin >> Bin;
    TempBin = Bin;
    do {
    if ((TempBin % 10)==0 || (TempBin % 10)==1) // Note (1)
    valid='Y';
    else {
    cout << "Invalid pattern! use 0's and 1's only\n\n";
    valid='N';
    break;
    TempBin = (TempBin/10);
    } while (TempBin>0);
    } while (valid=='N');
    // part 3 : Convertion
    div = 1;
    Dec = 0;
    TempBin = Bin;
    do {
    Dec += (TempBin % 10)*div; // Note (2)
    div *= 2;
    TempBin = (TempBin/10);
    } while (TempBin>0);
    cout << "\nThe binary pattern " << Bin << " is equal to "
    << Dec << " in decimal pattern.\n" << endl;
    // part 4 : try another number ?
    cout << "\aTry another number (Y/N) : ";
    cin >> again;
    cout << "\n";
    } while (again=='Y' || again=='y');
    cout << "\n" << endl;
    system("PAUSE");
    return 0;
    Appreciate your help. Thank you.
    CK

    So for Java, in your example, it takes a Java
    String like "1001" and converts it to an int whose
    value is one thousand and one. Can suggest a code for
    this that takes user input str and convert to bin int.
    I read books and noticed they are various ways to do
    that. I am quite confused actually. It is like there
    is no fix way to do that, unlike C++ which is more
    easier to understand(in my opinion). Probably, because
    I knew C better than Java.
    The 'standard' way to take a String and convert it to an int...
    int TempBin=Integer.parseInt(your_string);
    You seem to be saying that you do not want to use the standard method, so you should not complain that there is no standard method. Here's some code that re-uses most of your modulo 10.
    import java.io.*;
    public class Test {
         public static void main(String []args) throws IOException {
              BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
              String result=null;
              while(true) {
                   String input=bf.readLine().trim();
                   try {
                        long v=Long.parseLong(input);
                        result=toBin(v);
                        System.out.println(result);
                   } catch(NumberFormatException e) {
                             System.out.println("Only enter 1 or 0, nothing else!");
                   System.out.println();
           public static String toBin(long btemp) {
              long temp=btemp;
              do {
                   if ((temp % 10)!=0 && (temp % 10)!=1) {
                        System.out.println("Invalid pattern! use 0's and 1's only\n\n");
                        return null;
                   temp = (temp/10);
              } while (temp>0);
              // part 3 : Convertion
              int div = 1;
              int Dec = 0;
              long TempBin = btemp;
              do {
                   Dec += (TempBin % 10)*div; // Note (2)
                   div *= 2;
                   TempBin = (TempBin/10);
              } while (TempBin>0);
              return ""+Dec;

Maybe you are looking for

  • Project Management

    I have to build a simple java IDE for my software engineering class, and i am stuck on how to implement a project managenent system. Can anyone suggest a way to do it, or does anyone know how visual cafe or other IDE's do their project management. Oh

  • Force jvm to use UTF8 encoding for properties?

    hi, my problem is i cannot display turkish characters that are retrieved from properties file [(key, value) pair].The value may contain turkish characters. reference : java toc "..When saving properties to a stream or loading them from a stream, the

  • My open tabs are not being restored/remembered after closing

    Hi, I have my settings set to "Show windows and tabs from last time", however for some reason its not working anymore. Whenever I close my tabs, Firefox warns me that I'm closing multiple tabs and when I reopen Firefox, I only get my homepage. In the

  • How can I set down the UIScrollBar of my TextArea?

    Hello world... I have a little problem: I have a TextArea for a Chat. When I write a lot, the UIScrollBar remains on the top of my TextArea... I'd like my UIScrollBar is located at the bottom of TextArea... Can someone help me? Thanks. Emiliano.

  • Sales office O 00001006 is not available

    hi all, i am getting an error in bdoc while i was request downloading CUSTOMER_REL object for a particular BP. it is giving BDOC in red state stating that 'Sales office O 00001006 is not available'. when i looked for that sales office in ppoma_crm it