Converting CPP code into JAVA Code

i have made a cpp file that is running fine... is ther a tool which can convert that cpp file into java file easily?

No

Similar Messages

  • How to transform this pascal code into java code!

    I want to transform this pascal code into java code . Please tel me how to do it because I really don't know how to do it!
    Thanks!
    {CALCULATE HOHN-LONDON FACTORS}
    var kk:tab4;
    PROCEDURE INTENS(var kk:tab4);
    begin
    for n:=0 to nr+2 do
    begin
    kk^[1,n]:=sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1)) +lup*(yg-2);
    kk^[2,n]:= sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1))-lup*(yg-2);
    kk^[3,n]:=0.5*(kk^[1,n]*kk^[1,n]+4*(sqr(n+1)-lup*lup));
    kk^[4,n]:= 0.5*(kk^[2,n]*kk^[2,n]+4*(sqr(n+1)-lup*lup));
    kk^[5,n]:= sqrt(ldown*ldown*yd*(yd-4)+4*sqr(n+1)) +ldown*(yd-2);
    end;
    end;
    BEGIN
    new (kk);
    intens(kk);
    writeln(f2,' ','N ','V','branch ','H-L');
    for n:=1 to np do
    begin
    fp1[n,v]:=(n-ldown)*(n+ldown+1)*sqr(kk^[2,n-1]*kk^[6,n]+4*(n+ldown)*(n-ldown+1));
    fp1[n,v]:=fp1[n,v]/(4*(n+0.5)*kk^[4,n-1]*kk^[8,n]) ;
    writeln(f2,' ',n,' ',v,' fp1 ',fp1[n,v]:10:2);
    end;
    for n:=1 to nq do
    begin
    fq1[n,v]:=sqr(kk^[2,n]*kk^[6,n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)) ;
    fq1[n,v]:=fq1[n,v]/(2*(n+0.5)*kk^[4,n]*kk^[8,n]*(n+1.5));
    fq1[n,v]:=fq1[n,v]*(n+1);
    writeln(f2,' ',n,' ',v,' fq1 ',fq1[n,v]:10:2);
    end;
    for n:=1 to nr do
    begin
    fr1[n,v]:=sqr(kk^[2,n+1]*kk^[6,n]+4*(n-ldown+2)*(n+ldown+1));
    fr1[n,v]:=fr1[n,v]/(4*kk^[4,n+1]*kk^[8,n]*(n+1.5));
    fr1[n,v]:=fr1[n,v]*(n-ldown+1)*(n+ldown+2) ;
    writeln(f2,' ',n,' ',v,' fr1 ',fr1[n,v]:10:2);
    end;

    Basically it looks like this:
    public class KK{
         private your_type[][] kk = new your_type[length][length];
         private void intens(your_type[] kk){
              for(int n= 0; n<nr+2; n++){
                   kk[1][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2)) +lup*(yg-2);
                   kk[2][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2))-lup*(yg-2);
                   kk[3][n] = 0.5*(kk[1][n]*kk[1][n]+4*(Math.pow((n+1), 2)-lup*lup));
                   kk[4][n] = 0.5*(kk[2][n]*kk[2][n]+4*(Math.pow((n+1), 2)-lup*lup));
                   kk[5][n] = Math.sqrt(ldown*ldown*yd*(yd-4)+4*Math.pow((n+1), 2)) +ldown*(yd-2);
         public static void main(String args[]){
              KK k = new KK();
              k.intens(kk);
              System.out.println(f2  + ' ' + 'N ' + 'V' + 'branch ' + 'H-L');
              for(int n=1; n < np; n++){
                   fp1[n][v] = (n-ldown)*(n+ldown+1)*Math.pow((kk[2][n-1]*kk[6][n]+4*(n+ldown)*(n-ldown+1)), 2);
                   fp1[n][v] = fp1[n][v]/(4*(n+0.5)*kk[4][n-1]*kk[8][n]) ;
                   System.out.println(f2 + ' ' + n + ' ' + v + ' fp1 ' + fp1[n][v]:10:2);
              for(int n=1; n< nq;n++){
                   fq1[n][v] = Math.pow((kk[2][n]*kk[6][n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)), 2);
                   fq1[n][v] = fq1[n][v]/(2*(n+0.5)*kk[4][n]*kk[8][n]*(n+1.5));
                   fq1[n][v] = fq1[n][v]*(n+1);
                   System.out.println(f2 + ' ' + n + ' ' + v + ' fq1 ' + fq1[n][v]:10:2);
              for(int n=1; n < nr; n++){
                   fr1[n][v] = Math.pow((kk[2][n+1]*kk[6][n]+4*(n-ldown+2)*(n+ldown+1)), 2);
                   fr1[n][v] = fr1[n][v]/(4*kk[4][n+1]*kk[8][n]*(n+1.5));
                   fr1[n][v] = fr1[n][v]*(n-ldown+1)*(n+ldown+2) ;
                   System.out.println(f2 + ' ' + n + ' ' + v + ' fr1 ' + fr1[n][v]:10:2); //fr1[n][v]:10:2 --> Here you must use the BigDecimal class
    }I'm not very sure because my pascal knowledge is extremely "dated".
    What about the converter I told you about?

  • How to convert Vb code into java?

    Hi,
    I want to know how to make conversion a visual basic source code into java. The conversion could be (1:1) scale.
    Is there any compilers making the live easier (solving this problem) ?
    Thank you all.
    Abu_ramla

    Use the JNI. VB doesent actually do anything on its own. Its just a series of calls on COM objects to performs all its work. You can call these same COM objects using the Java Native Interface or JNI. You wont have access to things designed in VB though like forms, you will have to redesign those.
    This will take extensive knowledge of COM, VB, Java, and JNI. It will take you about 1 year to get up to speed. I would say to not do this.

  • Convert SQL statements to JAVA Code ?

    Using SQL queries Can I convert SQL statements to JAVA Code ?
    Edited by: user11238895 on Jun 7, 2009 10:54 PM
    Edited by: user11238895 on Jun 7, 2009 11:12 PM

    Me very new to Oracle.
    can we convert SQL Queries to JAVA Code using simple built in SQL queries ?
    Which SWISS SQL Tool does [Converting SQL Queries to JAVA Code]

  • "embed" image data into java code

    I have a mind that is it possible embed image file into java code?
    That mean an image file information already store in java code, thus no need using the image file in run-time. Then can prevent user change other image file instead.
    Do anyone try before, are there technologies required?
    I just want to know is it possible or not....thanks.

    technologies? The solution you are asking for is all about storing your data in static variables such as byte[][] used to build your image instance. I guess you should have a look at the different constructors of BufferedImage.

  • Pythagors into java-code (i got the idea, i think,  but need it simplified)

    Goodday all :),
    I have been trying to turn the forumula | a^2 + b^2 = c^2 | into java code.
    To clear it up a little more;
    1. Define unknown variable
    2. Define values of other two variables
    3. Program calculates
    x1. unkown variable is 'a'
    x2. b = 20 , c = 40
    x3. a = [(40^2) - (20^2)] ^0.5 (sorry couldnt figure out superscript)
    What i was thinking as a concept;
    1. Java asks for uknown value -> user defines as 'a' , 'b' or 'c'.
    2. Java If else statement
    2.1 if 'd' -> java asks again
    2.2 else 'e' --> java asks again etc (if else statemenst from d - z)
    import java.io.*;
    public class example {
         public static void main(String[] args) {
              System.out.println("define uknown value");
              BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
              boolean running = true;
              while(running) {
                        String line = reader.readLine();
                        if (line.startsWith("d")) {
                             System.out.println("wrong input, define unknown value");
                             running = true;
                             } else      if (line.startsWith("e")) {
                             System.out.println("wrong input, define unknown value");
                             running = true;
                             } else      if (line.startsWith("f")) {
                             System.out.println("wrong input, define unknown value");
                             running = true;
                             } else      if (line.startsWith("g")) {
                             System.out.println("wrong input, define unknown value");
                             running = true;and furter i was thinking;
    If a, b or c is pressed it will ask for the values of the other two
    and it will be such a code as above, repeating itself;
                        String line = reader.readLine();
                        if (line.startsWith("a")) {
                             System.out.println("please define b");
                             running = true;
                             if (line.startsWith("1")) {
                             int x = 1;
                             System.out.println("b=1");
                             running = true;
                             } else      if (line.startsWith("2")) {
                             int x = 2;
                             System.out.println("b=2");
                             running = true;
                             } else      if (line.startsWith("3")) {
                             int x = 3;
                             System.out.println("b=3");
                             running = true;and so on till, lets say 1000?
    Now my question is;
    Is this the right way to make this program?
    I would have like a .java file of severel megebytes if i wanted the values to get up to 10000 or something >.<

    Aargh! No. This code snippet might be of help.
    try {
       int x = Integer.parseInt("42");
       System.out.println("X = " + x);
    } catch( NumberFormatException e ) {
       System.err.println("Not a number: " + e);
       e.printStackTrace();
    }You would probably also find it useful to read about "regular expressions" if you always expect the formula to have exactly the same form.

  • Converting this VBScript into Java???

    HI
    I hava found this VBSCript. But I like to work on java.Is it possible to convert this into java code. Basically the script runs something in the remote machine. If its possible ,would u pls tell me what special package I need ??
    call execprog ("217.138.120.34","c:\acad_deploy\AdminImage\install.bat")
    sub ExecProg(ServerName, ProgramName)
    '     dim process as object, processid as long, result as long
         set process=getobject("WinMgmts:{impersonationLevel=Impersonate, authenticationLevel=pktPrivacy}\\" & servername & "\root\cimv2:Win32_Process")
         result=process.create(programname, null, null, processid)
         if result=0 then
             msgbox "Command executed successfully on remote machine"
         else
             msgbox "Some error, could not execute command"
         end if
    end sub Thanks in advance

    I hava found this VBSCript. But I like to work on
    java.Is it possible to convert this into java code.Yes, it is possible to convert the VBScript program in to Java code. You need to identify what the program (script) does and what the other programs are doing as well. (You said the VBscript calls other programs on remote machines). After this, design a way to implement same functionality with Java.
    Basically the script runs something in the remote
    machine.What "something"?
    If its possible ,would u pls tell me what
    special package I need ??It is possible, in order to convert the VBScript program to Java, you will have to create a Java package to contain the class hiearchy, i.e. com.admin.install.*
    And of course you will need packages from J2SE and possibly J2EE. The Runtime and Process classes from J2SE are examples what is available. These objects can be used to used to call the other programs. Your design will depend on details of the other programs.
    Do you plan on converting the "install.ba" program to Java as well?

  • How to convert Property files into Java Objects.. help needed asap....

    Hi..
    I am currently working on Internationalization. I have created property files for the textual content and using PropertyResourceBundles. Now I want to use ListResourceBundles. So what I want to know is..
    How to convert Property files into Java Objects.. I think Orielly(in their book on Internationalization) has given an utitlity for doing this. But I did not get a chance to look into that. If anyone has come across this same issue, can you please help me and send the code sample on how to do this..
    TIA,
    CK

    Hi Mlk...
    Thanks for all your help and suggestions. I am currently working on a Utility Class that has to convert a properties file into an Object[][].
    This will be used in ListResourceBundle.
    wtfamidoing<i>[0] = currentKey ;
    wtfamidoing<i>[1] = currentValue ;I am getting a compilation error at these lines..(Syntax error)
    If you can help me.. I really appreciate that..
    TIA,
    CK

  • Please help me transform this C++ code to java code....

    guys...please help me transform this C++ code to java code....please try to explain the code..thanks
    [program]
    #include <stdio.h>
    #define ALIVE 1
    #define DEAD 0
    #define SZ 33
    int stschk (int ,int );
    main()
    int s[SZ][SZ], i, j;
    for (i=0; i<sz; i++ ) s[0] = DEAD;
    for (j=0; j<sz; j++ ) s[0][j] = DEAD;
    s[0][1] = ALIVE;
    for (i=0; i<sz-1; i++) {
    for ( j=1;j<sz;j++ ) {
    s[i][j] = stschk(s[i][j-1],s[i+1][j];
    if(s[i][j-1]==ALIVE) printf("*");
    else printf(" ");
    printf("\n");
    int stschk(int s1,int s2)
    if(((s1==DEAD)&&(s2==ALIVE))||
    ((s1==ALIVE)&&(s2==DEAD))) return ALIVE;
    else return DEAD;

    Being picky, that's not C++, that's C. Standard headers in C++ dont' have .h after them, loop variables are scoped with the for, you use constants rather than #defines, etc..
    C and C++ both don't initialise arrays by default; you'd have to write an initialiser to get it to zero out the array:
        int s[sz][sz] = {};gcc will insert a call to memset to zero the array.
    If the author was assuming that the array was zeroed out, there would be no point zeroing the first row and column.
    The code reads values which haven't been initialised. If you mark such values explicitly undefined, and change the program to report an error when undefined, then you get several cases where the program makes such report.
    So either it' s a primitive random number generator (some random number generators use uninitialised memory as a source of randomness), or it's buggy, or it's processing undefined data and throwing away the result. Either way, it cannot be directly be ported to Java if the undefined values (which are limited to a small area of the ouput) are significant.

  • Converting oracle forms into java forms

    Hi all,,
    would help me plz on how to convert oracle forms into java using any tool;
    Is Jheadstart is the tool,, im having jeveloper version 10.1.2.1.0

    There are at least two companies that are marketing Forms to Java conversion tools. I'm sure that a good Google search will locate them, and they are frequent exhibitors at Oracle-oriented conferences like Collaborate and ODTUG Kaleidoscope. But there are problems associated with doing this. I urge anyone who is considering such a project to read this article by Grant Ronald: http://www.oracle.com/technology/products/forms/pdf/10gR2/formsmigration.pdf
    You should carefully ask yourself and your clients and management, "Why do you want to do this?", "What benefits are you trying to realize?", "Does this make sense, and are there other options that we should be exploring?"
    For instance, many people are trying to protect themselves because "Forms is going away". Oracle has stated again and again that Forms is NOT going away. In fact the recent Fusion Middleware 11g release included a new version of Forms with some significant enhancements. You may do very well just by upgrading to the latest version of Forms.
    If you do decide that it still makes sense to convert, I suggest that rather that converting, you may want to redevelop from scratch. Keep the database if it is well designed - a well designed, stable database will outlast any front end that you may use against it. Then take full advantage of the capabilities of your new toolset, and leave behind the limitations and inapplicable methodologies of your old one. Oh, by the way, don't use JDeveloper 10.1.2. Use 11g if you can, or 10.1.3.5 if you must.

  • How to convert csv files into java bean objects?

    Hi,
    I have a CSV file, I want to store the data availabale in that csv file into java bean, I am new to this csv files how can I convert CSV files into java beans.
    Please help me.
    Adavanced Thanks,
    Mahendra

    You can use the java.io API to read (and write) files. Use BufferedReader to read the CSV file line by line. Use String#split() to split each line into an array of parts which were separated by comma (or semicolon). If necessary run some escaping of quotes. Finally collect all parts in a two-dimensional List of Strings or a List of Javabeans.
    java.io API: [http://www.google.com/search?q=java.io+javase+api+site:sun.com]
    java.io tutorial: [http://www.google.com/search?q=java.io+tutorial+site:sun.com]
    Basic CSV parser/formatter example: [http://balusc.blogspot.com/2006/06/parse-csv-upload.html]

  • Convert Oracle Forms into Java (swing & JSP's)

    Dear All,
    We are currently in the process of evaluating our upgrade of system, which is using forms 4.5. One of the options we are considering at this stage is converting all forms into Java program. I am currently doing some pilot work on this project. I am using FormsWizard, a product of InformatikAtelier Gmbh, along with Forms 6i and Jdeveloper 9i. Has any one done this before in this group? Your assistance is much appreciated.
    Regards
    Michael Sesuraj.
    Oracle 8i Certified Database Administrator
    Sun Certified Java 2 Programmer

    Grant, Thanks for that mail. It was very useful article. The article has lots of brilliant points consider. I may have to discuss with our System Architect. With my experience in both forms and Java, it is hard to justify the business benefit out of this conversion. We are a strong Oracle house and have no intention of moving towards J2EE at this stage.. Thanks once again.
    Michael Sesuraj
    Oracle 8i Certified Database Administrator
    Sun Certified Java 2 Programmer

  • How to convert pl/sql code into java/j2ee

    Hi,
    We have a PL/SQL Oracle App server application that we will support if we can convert in j2ee/java. But when i did take a look at the code, these pl/sql contains all HTML and java code inside the stored procedures.
    And iam looking to explore some tools and mechanisms that can convert these pl/sql in a JAVA application so that i can deploy this new app into my BEA81 environment.
    Does any body has any idea:
    a) How to convert from pl/sql > java ?
    b) Any plugins or tools of BEA that can run these pl/sql (the way thay are currently...i.e w/o converting) in BEA 81 container ?
    thanks, sangita

    these pl/sql contains all HTML and java code insideJava or JavaScript. They are not the same. I wouldn't expect to see Java inside html, whereas JavaScript would be intermixed. On the other hand you might have a java stored proc (Oracle 9/10) which is generating HTML.
    >
    Does any body has any idea:Refactor.
    I doubt it just has html and JavaScript/Java. So what you have is a mess that mixes several things that should have been seperate in the first place.

  • Converting String into Java code

    Hi everyone,
    I will describe the scenario I have. I have a GUI application. I want the user to write some Java code in a text box and plug that code during runtime. Is there a way in Java so that a string could be used as a Java code?
    You help is really appreciated.
    Thanks
    RG

    catch the string input
    output string (code) to file
    call javac on the file you made
    that's it, you have a class, and you can run it/load it

  • 3DES - Php crypto codes 2 Java codes convertion problem

    I give all php and java codes I convert one by one but I didnt get same result where is my mistake and what shall I do. Thanks for all.
    Php Code
    $key = "db9ca45ee012dcabaff193ca";
    $input = sha1("MehmetKaraman");
    $td = mcrypt_module_open('tripledes', '', 'ecb', '');
    $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
    mcrypt_generic_init($td, $key, $iv);
    $encrypted_data = mcrypt_generic($td, $input);
    mcrypt_generic_deinit($td);
    mcrypt_module_close($td);
    echo sha1(bin2hex($encrypted_data));
    Output : d7eaa53ab43683a1323cfae877a24efb4a918411
    Java Code :
    String message= “MehmetKaraman”;
    byte[] input = MessageDigest.getInstance("SHA1").digest(message.getBytes("utf-8"));
         final Cipher cipher = Cipher.getInstance("DESede/ECB/NoPadding");
         final SecretKey key = new SecretKeySpec("db9ca45ee012dcabaff193ca".getBytes("utf-8"), "DESede");
    cipher.init(Cipher.ENCRYPT_MODE, key );
    if( input.length % 8 != 0){
         byte [] in2 = new byte[input.length+ 8- input.length%8];
         for(int i = 0;i<input.length;i++){
         in2=input[i];
         input = in2;
         final byte[] encrypted_data = cipher.doFinal(input);
         System.out.println(bin2hex(MessageDigest.getInstance("SHA1").digest(bin2hex(encrypted_data).getBytes())));
    Output : 626b61642ec4ba8f7467933832619d492a6fdde1

    Either you need$input = sha1("MehmetKaraman", true);or in your Java you need to hex encode your sha1 digest before encrypting. When I do either of these and emulate your Java bin2hex() method I get a match.
    I don't understand why people seem unable to do simple debugging. If you had read the PHP documentation for the sha1() function and had printed out the results at each stage it would have been obvious.
    P.S. The zero padding implemented by your codeif( input.length % 8 != 0){
    byte [] in2 = new byte[input.length+ 8- input.length%8];
    for(int i = 0;i<input.length;i++){
    in2=input[i];
    input = in2;
    }can be replaced by 1 line using one of the methods in class java.util.Arrays.
    Edited by: sabre150 on Sep 15, 2010 3:10 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for