Simple integer generation  using java math classes

I want to generate a integer which should be combination of 2 integer and one int
and anytime I call generate it should generate same value for same input and for different combinations it should generate different value.
for example I passed to the service two integers 24, 25 and one int 76
assume it generated 242576
I restart jvm to the service pass the same values mentioned above it should return me same output 242576.
I want to do this using some math functionality not using string concatinating ?Any suggestions on acheiving this? any help is greatly appreciated.
miro

How would you arrive at 242576 from 24, 25 and 76 when performing the operation by hand, on paper? What calculations would you need to perform?
Your other requirements are standard properties of programming: unless you go out of your way to make it otherwise, methods/functions tend to produce the same output based on the same input.
BTW, you won't need any math classes for this, just mathematical operators like +, -, *, / etc.

Similar Messages

  • Using java math class  for power's SQ rt and rounding.

    Hey all
    ive attempted to use maths class to create a program a user can enter a number and then the output shows
    The number rounded to the nearest integer
    The Square root of the number
    and finaly the number to the power of 6
    So far i have the following code but im a bit thick to what im missing ....
    import java.util.*;
    public class Mathclass
         public static void main(String[] args)
         Scanner kybd = new Scanner(System.in);
         double num = kybd.nextInt(); // kybd is an instance of Scanner
         public static double ceil (double num);
         public static double sqrt (double num);
         public static double exp (double num);
    }}Please be kind i know the outputs arnt there yet but im getting 15 errors in javac
    Thankyou

    Javaman01 wrote:
    i can understand that you feel this way , i just have a lot of programs i need to complete for a portfolio tommorow , so i need all the help i can get.Well, then I guess you started too late. Talk to your teacher that you won't be able to get it done on your own. Start learning your course book or the basic tutorials I posted and try to do the assignments again. I really think you know too little to get this done.
    Javaman01 wrote:
    if you wish not to help the please dont comment as i fear this will put others of helping me when i need it most.I did help you! And you have nothing to say about me posting here or not. Just as I can't stop you from trying to get others to do your homework.
    Javaman01 wrote:
    thankyouYou're welcome.

  • XSLT Mapping : RFC Lookup using java helper class

    Hi All,
    I am doing RFC Lookup in xslt mapping using java helper class. I have found blog for the same (http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14) However this blog is very advanced.
    Can anybody help me with step by step approach for the same?
    My basic questions are not answered in the blog as:
    1) where to add the jar file of the java class used in xslt mapping.
    I have added zip file of XSLT mapping in imported archived and using that in mapping.
    Thanks in advace.
    Regards,
    Rohan

    Hi,
    Can u please have look at this in detail , u can easily point out yourself the problem...
    http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/content.htm
    Please observe the line,
    xmlns:javamap="java:com.company.group.MappingClass
    in XSLT mapping..
    The packagename of class and class name and XSLT namespace should be matching...
    Babu
    Edited by: hlbabu123 on Sep 29, 2010 6:04 PM

  • How to use java.lang.Class.getMethod() and java.lang.reflect.Method.invoke(

    I want to call a specified method of one class dynamically. I use the method
    "getMethod()" in package "java.lang.Class" to get method and "invoke()" in
    " java.lang.reflect.Method " to invoke method.
    The problem is as following :
    1. There are two argument in this method "getMethod(String MethodName , Class[] paremterTypes)" in package "Class". I have no idea about the second parameter " Class[] parameterTypes ".what does the argument exactly mean ?
    2. There are two argument in the method "invoke(object obj, object[] obj)" in package "Method".
    I have no idea about the second parameter "object[] obj ".what is mean ?
    I pass " null " value to it and it works.But i pass anothers ,jvm will throw exception.

    I have a generic Method Executer that has a method like
    public Object execute(String className, String methodName, Object args)
        String fullClassName = packageName + className ;
        Class delegateClass = Class.forName(fullClassName);
        BaseDelegate delegate = (BaseDelegate)delegateClass.newInstance();
        Method method = null;
        if (args == null)
            method = delegateClass.getMethod(methodName, new Class[] {});
            obj = method.invoke(delegate,new Object[] {});
        else
            method = delegateClass.getMethod(methodName, new Class[] {args.getClass()});
            obj = method.invoke(delegate, new Object[]{args});
       }This seems to have problems when I call the method from a class like:
    execute("CategoryDelegate", "getCategoryById", new Integer(4144));(I get a NoSuchMethodException)
    The method I am trying to execute in CategoryDelegate looks like:
    public Category getCategoryById(int categoryId) throws DelegateExceptionI think it has to deal with the difference in the way we handle Primitive Wrappers and Objects. Wrapper we have to use Interger.TYPE and with the rest of the Objects we have to use obj.class.
    Am I doing something wrong here? Any suggestions to make it work for primitive wrappers as well as Objects?

  • Using java.math

    Hey guys,
    I've got yet another question !
    I want to the math.floor to round my double numbers down.
    I've declared "import java.math.*;" at the very start
    but how do you use math.floot actually?
    I've put
    double number = 1.25
    double roundednumber = math.floor(number);
    but it cannot find symbol math...I did something wrrong...

    Hey guys,
    I've got yet another question !
    I want to the math.floor to round my double numbers down.
    I've declared "import java.math.*;" at the very start
    but how do you use math.floot actually?
    I've put
    double number = 1.25
    double roundednumber = math.floor(number);
    but it cannot find symbol math...I did something
    wrrong...As Jos already pointed out: it's with a capital M.
    Note that the Math class is not in the java.math package but in the java.lang package which is automatically imported.
    This is the java.math package:
    http://java.sun.com/j2se/1.5.0/docs/api/java/math/package-summary.html
    And this is the java.lang.Math class:
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Math.html

  • Use java mapping class on PI 7.0

    Hi experts,
    I have a problem with a java mapping class on PI 7.0, maybe somebody could help me.
    I have a java mapping that call a webservice using AXIS library. If I run on my PC the java mapping is working. I load on Imported Archive the Java mapping class and AXIS librarys. My Java mapping class is compilated by jdk 1.4.2.09, like others java mappings that i have on PI 7.0 system, but when I execute the interface, its returns an error:
    Incompatible class versions (linkage error)
    This error is caused by AXIS Libraries, I use AXIS 1.4 version, and I think that this version is using jdk 1.5 because I read it on some foros. Could somebody confirm it? If it is true, could somebody tell me if there are some AXIS version that use jdk 1.4 or maybe How could I solved it? Thanks.
    Regards,
    Gemma

    Incompatible class versions (linkage error)
    this is usually when the jdk version of XI server and the library version you used to develop the mapping are incompatible. Make sure you use the same version as of the server

  • How can I use java swing class in JSP page design

    I am a new developer in Java server pages. I want to use layout managers available in java swing classes to design the page. Can any body suggest me a way to do this.Is it possible if I do it with servelets.

    So, you want to use layout managers within your JSPs?
    The immediate answer is that "it isn't a good idea". The more considered answer is "tell us what you're up to".
    Are you coding all presentation within a traditional JSP? That is, HTML, customer or library tags and/java scriptlets?
    Or are you building your HTML within your servlets and sending that back to the browser?
    If the first, then you are probably better off either using explicit HTML tables (or the equivalent custom tags) or finding a library that you can use.
    If the second, you can write classes similar to the Swing layout managers that end up being a fancy way of putting elements into an HTML table. We have exactly that in my current environment. I wouldn't recommend rolling your own and I'd tend to leave all that presentation stuff to the JSP.
    In any case, you can't really use the Swing layout managers as they are for an entirely different pradigm.

  • XI: How To Use JAVA generic Class to  perform SAP data Lookup........

    Hello All,
    I want to create a generic class which is used to perorm SAP data lookup.
    I don't want to use Jco or RFC channel..
    Is there any other way to do this?
    waiting for Reply 
    thank in advance.
    - AKSHAY.

    Hi,
    use RFC channel
    you can wrap it up like this:
    /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    why do you want to create something diffucult to maintin and non standard if
    you can use the RFC API ?
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Report generation using java.

    Is there any classes/tools avalaible to generate database related reports using java?????

    Supoose I have a database table named EMPLOYEE having fields "name", "dept", "salary".
    I want to generate reports with the records of the table
    for the printing purpose.
    The report should have proper format and it will show the monthly total and yearly totals of all employees' salary.
    e.g. name department salary
    John Systems 20000
    Rian Sales 80000
    total 100000
    The report can be more complex. As number of tools are available for development of reports in VB and D2k etc.
    I want to know whether any JAVA tool or classes are available to generate complex reports.

  • Password protected Excel file generation using Java

    Hi,
    I want to create password protected excel file using Java. So when you manually open this file it should prompt for password.
    There are APIs but they are licensed and are for trial period. I want solution which is free.
    I need this solution urgently..
    :-)

    Swati.S wrote:
    Hi Administrator,
    Moderator. Administrators post with the Sun logo.
    I'm sorry I wasnt aware that we cannot have off forum communication. Can you please communicate how I can spread this message taht solution for this is available.If you like, you can post the code here or on [SDN Share|http://sdnshare.sun.com/]. Apart from that, there's no shortage of blog sites.

  • Java Math Class

    Looking for a math class method to calculate prime numbers up to 1000 and also perfect numbers up to 1000. Anybody know if one is available ?

    You can try the following if you think it might help:public class MyMaths extends Homework {
        public static int[] primesUpToN(int n) {
            researchTopics.add("Eratosthenes' Sieve");
            researchTopics.add("Prime Numbers");
            addKnowledge(researchTopics.performResearch());
            Algorithm al  = codeAlgorithm(knowledge, skills, resources);
            while (!al.testsSuccessful()) {
                Bug bug = al.debug().getNextBug();
                bug.quash();
            return al.apply(n);
        public static void main(String[] args) {
            System.out.println(primesUpToN(1000));
    }-- Scott

  • How can i built a java application using java debug class on Log4J

    Hi,
    As java API support the MethodEntryEvent, using which I can get the automatic logging statements when the method is entered or exited as HelloExample.main(with argument type).
    Where HelloExample is the class name.
    Main is the method entered with its argument types.
    In some cases I have the o/p as
    -- VM Started --
    ====== main ======
    main -- HelloExample
    callerMethod -- HelloExample
    ====== main end ======
    -- The application exited --
    By using Log4J is there any possibility of getting these sort of o/p along with the loggers supported by Log4J. i mean to say can i built an java application which supports the MethodEntryEvent and MethodExitEvent from java API and also uses the Log4J debugging. I took an e.g. trace example, which (in J2SE 1.4.x or 5.x) will be found in $JAVA_HOME/demo/jpda/examples.jar and unpacking it by
    jar -xvf $JAVA_HOME/demo/jpda/examples.jar i found the com/sun/tools/example/trace/Trace.java and passed the class constructed with logger taken from Log4J. In this case the logging message is displayed on the console. As per the requirement i need to transfer the whole o/p to an output file along with Log4J logger statements. in this case i should not give any command in the cosule except compiling and executing the programme. the programm also should able to run without the main() as i need to integrate Log4J with an application and the code must me application server independent. i need the output as i got using MethodEnteryEvent (shown as above) in case of java application built using Log4J.
    Can any one help me in this regard. can any one give me some suggestion or any programme of this sort. All suggestions are welcomed.
    Thanks & Regards,

    hi,
    can someone help me how to implement logging for method entry parameters and
    method exit return value.
    can someone help me how to use log4j and integrate it to the method entry
    logging and method exit logging.
    Here what i need is without writing the log statements for the method entry and
    method exit i need to log it to the file
    along with other log4j debug statements i provide in the file.I should be able
    to configure whether to enable/disable the logging
    for method entry and method exit. In method entry i should be able to log the
    parameters the method take and in method exit
    i should be able to log te return value to the log file, before the method is
    returned to the callee.
    i hope i am clear
    Thanks in advance.

  • Taking screenshot with java applet using java robot class not working

    Hi Everyone,
    I am using the java applet to take screenshot of the web browser using the java's robot class.
    Robot objRobot = new Robot ();
    BufferedImage objBufferedImage = objRobot.createScreenCapture(objRectArea);
    The thing work good in windows system taking screenshot but in case of mac osx i get the blank image.When i check the event viewer in mac osx i get the following error.
    invalid context
    invalid pixel format
    CoreAnimation: rendering error 506
    The problem is coming for all the browser safari,firefox and chrome.My applet is signed applet.
    What might be the reason.An early reply is very valuable.
    My machine configuration is as follows.
    OS : MAC OSX
    Version : 10.6.4
    Is that a system level issue , java plugin issue?I'am confused with this error.
    Thanks sagar.

    870613 wrote:
    invalid context
    invalid pixel formatHm, seems like the Mac implementation of the Robot class is doing some bad initializations there. I can't be a 100% sure of course, but this smells like a bug to me. Are you sure you have the latest version of Java installed?

  • Using Java 6 classes with Java 5

    I ran into a little problem with the portability of Java (ironic eh?) across computers. The program I wrote on my home computer uses GroupLayout for the GUI. However, much to my surprise, the computers at my school only had Java 5 installed so the program could not run (GroupLayout is a class found only in Java 6). Is there any way to somehow package the GroupLayout class into my program?

    C_Zhao wrote:
    I ran into a little problem with the portability of Java (ironic eh?) across computers.Not as ironic as you might think.
    The program I wrote on my home computer uses GroupLayout for the GUI. However, much to my surprise, the computers at my school only had Java 5 installed so the program could not run (GroupLayout is a class found only in Java 6). Is there any way to somehow package the GroupLayout class into my program?Technically, yes, but I'd imagine that rewriting your code to use a different layout manager (such as one of those available in J2SE 5) would be quicker / easier. In fact, I'm almost willing to guarantee that refactoring would be easier than repackaging.

  • Help needed for report generation using java technologies

    May i get some idea about report generation api available. some report generation tools that can be downloadble. can you please suggest how to use scheduling the printers or report generation by scheduling.

    e.g. for one of my school project which generate reconciliation report (banking project) we add in a letterheader and the rest of the information presented below.
    but there is some problem here.
    either you "catch" no. x row where the printing will be trancated then prevented it from trancated by formatting your pages such that data will not be printed in that region.

Maybe you are looking for

  • Using Adobe Bridge with Photoshop Elements

    I have an iMAC with iLife 08. I take photos in RAW format with a Nikon camera. I have been editing photos this way: After uploading photos to iPhoto, export them as jpg to a new folder on the desktop, external HD or wherever. I open Photoshop Element

  • Mac Volume and Sound Problem in newly installed Windows

    Hi Friends, I intalled the Windows 8 Developer Edition using Bootcamp 4.0 My Mac Volume/Hard Disk is not displayed in "My Computer". I read it will display the Volume in read-only mode. Can anyone help in making the Volume show on Windows? The sound

  • GR -BASED- IV

    Hi all , I have maintained split valuation for a material and valuation types are Q1(maintained condition records as 120/-) and Q2 (maintained condition record as 100/-) .I created PO with out any valuation type for  a material so at the time of GR b

  • Error code 2000

    I can't use one step IDVD because the error code 2000 pops up

  • IPhoto4 and e-mail using AOL

    I have iPhoto 4.0.3 and I could have sworn that last month I was able to send pictures via e-mail using my AOL. The other day, I was trying to send some pictures but I am unable to get select "America Online". Selecting the e-mail icon at the bottom