Using bigdecimal class

I was using Gregory-Leibniz series to calculate PI = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + ...
Something like:
double pi = 0.0;      
       int limit = 3000000;      
       for (int i = 0, y = 1; i <= limit; y+=2, i++)
                 if (y == 1)
                      pi = 4;
               else if (i % 2 == 0)
                      pi += (double)4/y;            
                 else
                      pi -= (double)4/y;                                                   
                 System.out.println(String.format("Loop %d: %.20f", i, pi));                                    }Then I realized PI isn't going to be totally accurate according to IEEE Standard for Binary Floating-Point Arithmetic that java math calculation uses, so I was trying to use BigDecimal class (new to me), this is what I got initally...
         BigDecimal pi = new BigDecimal("0.00");           
          int limit = 3000000;
          for (int i = 0, y = 1; i <= limit; y += 2, i++)
              if (y == 1)
                      pi = new BigDecimal("4.0");
               else if (i % 2 == 0)
                      pi = pi.add(new BigDecimal( Double.toString( (double) 4 / y )));
                 else
                      pi = pi.subtract(new BigDecimal( Double.toString( (double) 4 / y )));
                    System.out.println(String.format("Loop %d: %s", i, pi.toString()));                                       
I realize that when I do the 4/y calculations involving both doubles... the result is probably stored according to the IEEE standards which is the thing to avoid... Is that correct? Is my PI result going to be accurate?
I noticed with this one decimals up to the 22nd place are all filled with some numbers in the calculations compared with the first one involving only double number calculations which had zero's starting around the 15th decimal.
Something like doesn't work and ends up with arithmeticexceptions...
pi = pi.subtract(new BigDecimal("4").divide(new BigDecimal(Integer.toString(y))));
So I'm actually confused about the right way of using BigDecimal class in this type of calculation to get accurate results. I do realize it's an immutable class and probably a bad idea to use it like this 3 million times in a loop.

quoting from the API documentation on BigDecimal
"The BigDecimal class gives its user complete control over rounding behavior. If no rounding mode is specified and the exact result cannot be represented, an exception is thrown; otherwise, calculations can be carried out to a chosen precision and rounding mode by supplying an appropriate MathContext object to the operation."
That explains the arithmetic exceptions.
You would be advised to choose your scale first, (that would be the number of decimal places that you want to be using for your calculation. ) Then use the BigDecimal constructors that use the scale value. Construct your BigDecimal 4 outside of the loop so that you are not constructing it over and over again. And finally, read the documentation on how the scale of the result will depend upon the scale of the components going in.
A little reading and possibly re-reading of the documentation will help in the understanding of the BigDecimal class.

Similar Messages

  • Using BigDecimal

    My factorial is hitting a wall, and it is a huge decimal (I put it under 1). How do I use BigDecimal? Here is what I am using to solve these factorials:
        public static double factorial(double n) {
            if      (n <  0)  throw new RuntimeException("Can't be negative stupid.");
            else if (n > 250) throw new RuntimeException("Number too big at the moment! :(");
            else if (n == 0)  return 1;
            else              return (1 / (n * factorial(n-1)));
    double z = 200
    factorial(z);I get errors because I don't think double can handle something so large. How do I change that snippet of code to BigDecimal, rather how do I use it? The API sort of tells me this is much different from regular number types. Also, can a BigDecimal have a value in the ones or tens place, like 23.839281.... or is it strictly the decimal end, 0.839281... ?
    Edited by: kavon89 on Oct 9, 2007 10:49 PM

    I gave what the links said a shot, and I need some help debugging:
    Here is what worked:
    public class Main {
        public static void main(String[] args) {
            solveit();
        public static double factorial(double n) {
            if      (n <  0)  throw new RuntimeException("Can't be negative stupid.");
            else if (n > 100) throw new RuntimeException("Number too big at the moment! :(");
            else if (n == 0)  return 1;
            else              return 1 / (n * factorial(n-1));
        public static void solveit() {
            double z = 2;
            System.out.println(factorial(z));
    Here is what I tried to get BigDecimals in there:
    public class Main {
        public static void main(String[] args) {
            solveit();
        public static BigDecimal factorial(BigDecimal n) {
            BigDecimal m = new BigDecimal("1");
            n = n.setScale(5);
            return m.divide((n.multiply(factorial(n.subtract(m)))));
        public static void solveit() {
            BigDecimal z = new BigDecimal("2");
            System.out.println(factorial(z)); //1 / 2! == 0.5
    }and finally, my error:
    Exception in thread "main" java.lang.StackOverflowError
            at java.lang.Character.digit(Character.java:4494)
            at java.lang.Long.parseLong(Long.java:401)
            at java.lang.Long.parseLong(Long.java:461)
            at java.math.BigDecimal.<init>(BigDecimal.java:452)
            at java.math.BigDecimal.<init>(BigDecimal.java:647)
            at Main.factorial(Main.java:23)
            at Main.factorial(Main.java:25)
            at Main.factorial(Main.java:25)
            // the line above this repeats MANY times, and the message ends with...
    Java Result: 1
    BUILD SUCCESSFUL (total time: 1 second)What is wrong? :s Help!
    Edited by: kavon89 on Oct 9, 2007 11:43 PM

  • Floats using BigDecimal

    I am trying to float my answer using BigDecimal, anyone have any suggestions? PLease Help.
    import java.lang.reflect.*;
    import java.awt.*;
    import java.io.*;
    import java.math.*;
    class myMean
              public float myMean(float x)     
                   float result = 0;     
                   result = (x += result);
                   return (result);     
    class MethodCalls
         public static void main(String[] args) throws IOException
              // declarations
              BufferedReader in = new BufferedReader (new InputStreamReader(System.in));
              myMean out = new myMean();     
              String sArraySize, strgrade, strdecimal;                    
              double size =2;
              float score = 0, tracker = 0;      
              float FloatConversion;
              float callAverageMethod;
              int x= 0;
              System.out.println("Please enter the number of tests to average:");
              sArraySize = in.readLine();           
              size = Double.parseDouble(sArraySize);      
              System.out.println("Please enter the amount of decial places to use:");
              strdecimal = in.readLine();
              x = Integer.parseInt(strdecimal);
              for (float counter=0; counter < size; counter++)     
                   // input on the test scores come here          
                   System.out.print("What is the score of the " + (counter+1) + " test: ");
                   strgrade = in.readLine();
                   score = Float.parseFloat(strgrade);
                   tracker += score ;          
              callAverageMethod = out.myMean(tracker);
              System.out.println();      
              BigDecimal bd = new BigDecimal(callAverageMethod);
    bd = bd.setScale(x, BigDecimal.ROUND_UP);
              System.out.println(" The average score of the " + size + " tests is: " + bd/size);
    }

    Try doing the computation ( sum / num grades ) within the BigDecimal. If you create the BigDecimal and then do the integer division, you'll create a new double that isn't subject to the rounding.
    public class bdtest {
        public bdtest() {
        public static void main(String[] args) {
            float f = 100.0f;
            int n = 6;
            BigDecimal bd = new BigDecimal( f / n );
            bd = bd.setScale( 2, BigDecimal.ROUND_UP );
            System.out.println( bd );
    }

  • The BigDecimal class

    Hi there,
    I have Core Java2 put out by Sun and I just finished reading up on the use of the BigDecimal class. I think I want to implement it in my code b/c I'm losing accuracy when I'm multiplying doubles but the text isn't very clear and I don't fully understand what the BigDecimal class will do. Does it just ensure complete accuracy when performing math on two doubles? Any clarification would be appreciated.
    jjmclell

    Complete accuracy is impossible because somenumbers
    can't be represented inside computers.Technically speaking, you can represent all numbers,
    even irrational numbers inside a computer just as
    well as we can represent them on a notebook or
    blackboard.
    But anyway your advice was still good :)Well, yeah; you could define a number system with symbols to represent transcendental numbers, etc., infinity with different cardinalities, etc., whatever you need. Of course, you could only represent a finite number of these representations. I think this is a little bit out of the scope of what the OP was asking, though.

  • Using List Class in java.awt / java.util ?

    have a program that:
    import java.util.*;
    List list = new LinkedList();
    list = new ArrayList();
    ... read a file and add elements to array
    use a static setter
    StaticGettersSetters.setArray(list);
    next program:
    import java.awt.*;
    public static java.util.List queryArray =
    StaticGettersSetters.getArray();
    If I don't define queryArray with the package and class, the compiler
    gives an error that the List class in java.awt is invalid for queryArray.
    If I import the util package, import java.util.*; , the compiler
    gives an error that the list class is ambiguous.
    Question:
    If you using a class that exists in multiple packages, is the above declaration of queryArray the only way to declare it ?
    Just curious...
    Thanks for your help,
    YAM-SSM

    So what you have to do is explicitly tell the compiler which one you really want by spelling out the fully-resolved class name:
    import java.awt.*;
    import java.sql.*;
    import java.util.*;
    public class ClashTest
        public static void main(String [] args)
            java.util.Date today    = new java.util.Date();
            java.util.List argsList = Arrays.asList(args);
            System.out.println(today);
            System.out.println(argsList);
    }No problems here. - MOD

  • Creating a triangle using polygon class problem, URGENT??

    Hi i am creating a triangle using polygon class which will eventually be used in a game where by a user clicks on the screen and triangles appear.
    class MainWindow extends Frame
         private Polygon[] m_polyTriangleArr;
                       MainWindow()
                              m_nTrianglesToDraw = 0;
             m_nTrianglesDrawn = 0;
                             m_polyTriangleArr = new Polygon[15];
                             addMouseListener(new MouseCatcher() );
            setVisible(true);
                         class MouseCatcher extends MouseAdapter
                             public void mousePressed(MouseEvent evt)
                  Point ptMouse = new Point();
                  ptMouse = evt.getPoint();
                if(m_nTrianglesDrawn < m_nTrianglesToDraw)
                                int npoints = 3;
                        m_polyTriangleArr[m_nTrianglesDrawn]
                      = new Polygon( ptMouse[].x, ptMouse[].y, npoints);
    }When i compile my code i get the following error message:
    Class Expected
    ')' expectedThe two error messages are refering to the section new Polygon(....)
    line. Please help

    Cannot find symbol constructor Polygon(int, int, int)
    Can some one tell me where this needs to go and what i should generally
    look like pleaseI don't think it is a good idea to try and add the constructor that the compiler
    can't find. Instead you should use the constructor that already exists
    in the Polygon class: ie the one that looks like Polygon(int[], int[], int).
    But this requires you to pass two int arrays and not two ints as you
    are doing at the moment. As you have seen, evt.getPoint() only supplies
    you with a single pair of ints: the x- and y-coordinates of where the mouse
    button was pressed.
    And this is the root of the problem. To draw a triangle you need three
    points. From these three points you can build up two arrays: one containing
    the x-coordinates and one containing the y-coordinates. It is these two
    arrays that will be used as the first two arguments to the Polygon constructor.
    So your task is to figure out how you can respond to mouse presses
    correctly, and only try and add a new triangle when you have all three of its
    vertices.
    [Edit] This assumes that you expect the user to specify all three vertices of the
    triangle. If this isn't the case, say what you do expect.

  • Uploading bitmapData using FileReference class ?

    Hi gurus ;)
    Question nr 1.
    Is it possibly to upload bitmapData to server using
    FileReference class ? How should i approach this issue, is there
    any ready classes available for this purpose. I'm generating
    bitmaps inside my Flash/Flex App and need to store them under users
    profile in server.
    Question nr 2.
    Can i upload files from remote server to another using
    FileReference class
    e.g Somehow like :
    uploadURL = new URLRequest();
    uploadURL.url = "
    http://www.[yourDomain
    fileURL.url = "
    http://www.myLocation.com/myfile.JPG";
    file = new FileReference(fileURL.url);
    file.upload(uploadURL);
    This is just an idea, sure not working ;)
    Any ideas are helpful
    Thx
    iquaaani

    I did a small application that uploads a file to the server
    every hour. If the server response that a login is required to
    upload the file, it goes to a login page to do the login and
    retried to upload the file.
    I got the server response in order to know if the file did
    upload correctly or not (I have to send more form data than just
    the file). I didn't try the mime type since it's not relevant for
    my application and usualy this information is not very trust worthy
    anyways.
    I'm not sure what you mean with exceptions, if you are
    referring to HTTP errors, I think there is an event for that, but I
    used the IOError event for this, and it seems to work good
    also.

  • Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group.

    Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
    code I have used:
    //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "";
    Also I have used,
                 String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "ou=ibmgroups,o=ibm.com";
    But in both cases I am getting value for Total groups as 0.
    Code Reference:
    * memberof.java
    * December 2004
    * Sample JNDI application to determine what groups a user belongs to
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    public class memberof     {
         public static void main (String[] args)     {
              Hashtable env = new Hashtable();
              String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
              String adminPassword = "XXXXXXX";
              String ldapURL = "ldap://mydc.antipodes.com:389";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL,ldapURL);
              try {
                   //Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   //Create the search controls          
                   SearchControls searchCtls = new SearchControls();
                   //Specify the search scope
                   searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
                   //Specify the Base for the search
                   String searchBase = "DC=antipodes,DC=com";
                   //initialize counter to total the group members
                   int totalResults = 0;
                   //Specify the attributes to return
                   String returnedAtts[]={"memberOf"};
                   searchCtls.setReturningAttributes(returnedAtts);
                   //Search for objects using the filter
                   NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
                   //Loop through the search results
                   while (answer.hasMoreElements()) {
                        SearchResult sr = (SearchResult)answer.next();
                        System.out.println(">>>" + sr.getName());
                        //Print out the groups
                        Attributes attrs = sr.getAttributes();
                        if (attrs != null) {
                             try {
                                  for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
                                       Attribute attr = (Attribute)ae.next();
                                       System.out.println("Attribute: " + attr.getID());
                                       for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
                                            System.out.println(" " +  totalResults + ". " +  e.next());
                             catch (NamingException e)     {
                                  System.err.println("Problem listing membership: " + e);
                   System.out.println("Total groups: " + totalResults);
                   ctx.close();
              catch (NamingException e) {
                   System.err.println("Problem searching directory: " + e);
    Any help will be highly appreciated.

    Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
    code I have used:
    //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "";
    Also I have used,
                 String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "ou=ibmgroups,o=ibm.com";
    But in both cases I am getting value for Total groups as 0.
    Code Reference:
    * memberof.java
    * December 2004
    * Sample JNDI application to determine what groups a user belongs to
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    public class memberof     {
         public static void main (String[] args)     {
              Hashtable env = new Hashtable();
              String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
              String adminPassword = "XXXXXXX";
              String ldapURL = "ldap://mydc.antipodes.com:389";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL,ldapURL);
              try {
                   //Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   //Create the search controls          
                   SearchControls searchCtls = new SearchControls();
                   //Specify the search scope
                   searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
                   //Specify the Base for the search
                   String searchBase = "DC=antipodes,DC=com";
                   //initialize counter to total the group members
                   int totalResults = 0;
                   //Specify the attributes to return
                   String returnedAtts[]={"memberOf"};
                   searchCtls.setReturningAttributes(returnedAtts);
                   //Search for objects using the filter
                   NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
                   //Loop through the search results
                   while (answer.hasMoreElements()) {
                        SearchResult sr = (SearchResult)answer.next();
                        System.out.println(">>>" + sr.getName());
                        //Print out the groups
                        Attributes attrs = sr.getAttributes();
                        if (attrs != null) {
                             try {
                                  for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
                                       Attribute attr = (Attribute)ae.next();
                                       System.out.println("Attribute: " + attr.getID());
                                       for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
                                            System.out.println(" " +  totalResults + ". " +  e.next());
                             catch (NamingException e)     {
                                  System.err.println("Problem listing membership: " + e);
                   System.out.println("Total groups: " + totalResults);
                   ctx.close();
              catch (NamingException e) {
                   System.err.println("Problem searching directory: " + e);
    Any help will be highly appreciated.

  • Problem with constructors and using public classes

    Hi, I'm totally new to Java and I'm having a lot of problems with my program :(
    I have to create constructor which creates bool's array of adequate size to create a sieve of Eratosthenes (for 2 ->n).
    Then it has to create public method boolean prime(m) which returs true if the given number is prime and false if it's not prime.
    And then I have to create class with main function which chooses from the given arguments the maximum and creates for it the sieve
    (using the class which was created before) and returns if the arguments are prime or not.
    This is what I've written but of course it's messy and it doesn't work. Can anyone help with that?
    //part with a constructor
    public class ESieve {
      ESieve(int n) {
    boolean[] isPrime = new boolean[n+1];
    for (int i=2; i<=n; i++)
    isPrime=true;
    for(int i=2;i*i<n;i++){
    if(isPrime[i]){
    for(int j=i;i*j<=n;j++){
    isPrime[i*j]=false;}}}
    public static boolean Prime(int m)
    for(int i=0; i<=m; i++)
    if (isPrime[i]<2) return false;
    try
    m=Integer.parseInt(args[i]);
    catch (NumberFormatException ex)
    System.out.println(args[i] + " is not an integer");
    continue;
    if (isPrime[i]=true)
    System.out.println (isPrime[i] + " is prime");
    else
    System.out.println (isPrime[i] + " is not prime");
    //main
    public class ESieveTest{
    public static void main (String args[])
    public static int max(int[] args) {
    int maximum = args[0];
    for (int i=1; i<args.length; i++) {
    if (args[i] > maximum) {
    maximum = args[i];
    return maximum;
    new ESieve(maximum);
    for(int i=0; i<args.length; i++)
    Prime(i);}

    I've made changes and now my code looks like this:
    public class ESieve {
      ESieve(int n) {
       sieve(n);
    public static boolean sieve(int n)
         boolean[] s = new boolean[n+1];
         for (int i=2; i<=n; i++)
    s=true;
    for(int i=2;i*i<n;i++){
    if(s[i]){
    for(int j=i;i*j<=n;j++){
    s[i*j]=false;}}}
    return s[n];}
    public static boolean prime(int m)
    if (m<2) return false;
    boolean x = sieve(m);
    if (x=true)
    System.out.println (m + " is prime");
    else
    System.out.println (m + " is not prime");
    return x;}
    //main
    public class ESieveTest{
    public static int max(int[] args) {
    int maximum = args[0];
    for (int i=1; i<args.length; i++) {
    if (args[i] > maximum) {
    maximum = args[i];
    return maximum;
    public static void main (String[] args)
    int n; int i, j;
    for(i=0;i<=args.length;i++)
    n=Integer.parseInt(args[i]);
    int maximum=max(args[]);
    ESieve S = new ESieve(maximum);
    for(i=0; i<args.length; i++)
    S.prime(i);}
    It shows an error for main:
    {quote} ESieveTest.java:21: '.class' expected
    int maximum=max(args[]); {quote}
    Any suggestions how to fix it?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • End of Page event in ALV report using SALV class[cl_salv_hierseq_table]

    Hi ,
    have been working on a ALV report using the class SALV cl_salv_hierseq_table
    I am facing few issues pertaining to two things:
    1. Displaying some subtotal text along with the subtotals.
    Example refer the standard demo example: SALV_DEMO_HIERSEQ_FORM_EVENTS
    Now instead of A 17 and A26 I would like to show text like Subtotal for the Carrid.for subtotals and grand totals
    Like   Subtotal for A 17 is :      XXXXXXX
              GrandTotal is         :      YYYYYY
    2. We have a page break and a new page for every purchasing group as in the standard example SALV_DEMO_HIERSEQ_FORM_EVENTS for CARRID.
    I need to display some variable values as number of documents ,total number of records etc at the end of each CARRID group before a new page starts for the next CARRID.Please note i do not want it on every page.it should only be diaplyed at the end of page whose next page would be for next CARRID.[basically at end of every carrid]Example:after displaying all details for AA need to display the number of records for that carrid at the end of the page[as page break is based on CARRID]/
    Thanks
    Jyotsna

    at end of page event, for CL_SALV_EVENTS_HIERSEQ, has some useful parameters allowing to know where you are at the time of event
    parameter VALUE is of type CL_SALV_FORM which contains public attribute IF_SALV_FORM~ACCDESCRIPTION; you can slo get contents of it
    about text of total/subtotal, this is normally set in the layout

  • Use of classes Vs tables

    Hi All,
    I have e requirement where i need to select data from tables....... It was told to me that i can make use of classes instead of tables...... I am working on Inbound delivery in EWMmodule.......
    can any one through some light on this....... how can i make use of classes to get data from sap tables.........
    Regards,
    Poonam

    Hi Faisal,
    Just to correct you it's "Methods of Global Persistent Classes".
    Not to hide my ignorance in OOPs, but i don't think persistent classes should be used for mundane selects. It's much easier to write, maintain & troubleshoot a select construct than a persistent class
    You can go through this discussion on: Why do we need Persistent Classes ?
    BR,
    Suhas

  • Help using scanner class to count chars in file

    Hi all, I am learning Java right now and ran into a problem. I need to use the Scanner class to accurately count the number of chars in a file including the line feed chars 10&13.
    This what I have and it currently reports a 201 byte file as having 194 chars:
         File file = new File(plainFile);
         Scanner inputFile = new Scanner(file);
         numberOfChars = 0;
         String line;
         //count characters in file
         while (inputFile.hasNextLine())
              line = inputFile.nextLine();
              numberOfChars += line.length();
    I know there are other ways using BufferedReader, etc but I have to use Scanner class to do this.
    Thanks in advance!

    raichle wrote:
    Wow guys, thanks for the help! I've got a RTFMWell, what's wrong to have a look at the API docs for the Scanner class?
    and directions that go against the specs I said.Is that so strange to suggest a better option? What if I ask a carpenter "how do I build a table with a my stapler?". Should I give the man an attitude if he tells me I'd better use a saw and hammer?
    I'm also aware that it "eats" those chars and obviously looking for a way around that.
    I've looked through the java docs, but as I said, I'm new to this and they're difficult to understand. The class I am auditing req's that this be done using Scanner, but I don't see why you demand an explanation.
    Can anybody give me some constructive help?Get lost?

  • Customizing FD01 and FB70 using PS Class and Characteristics

    Hello SAP Experts
    I have the following issue:
    My client has a requirement where we need to customize the Customer Master  (FD01) screen and the Invoice Posting Screen (FB70). A few additional fields have to be added by creating a separate tab. I was intending to take Abaper's help and do this using user exits but I have been suggested by the cleint to use SAP PS Class and Characteristics feature to do this. Can someone please throw some light on this feature and how can i create custom fields on FD01 and FB70 screens. Is there a way we could customize these screens using PS class and characteristics. Your opinions would be much appreciated.
    Please kindly give your suggestions. Thanks in advance
    Regards,
    Nik

    Joao Paulo,
    Thank you for the response. I have tried to obtain some info from OSS but no luck. Tried all means but there is limited information available.
    Nik

  • How to use aggregation -Average using a class

    Hi Gurus,
       In my report i have used cl_salv_table  and for event i have used cl_salv_events_table, now i want to calculate average for some of the fields as such subtotal calculation . In my normal alv reports i have used the class lcl_event_receiver also, but for the report which iam using a class , i d'not know how to compain both the class  (i.e) cl_salv_table, class lcl_event_receiver. Help me to solve the problem.

    cancelled

  • Using a class or servlet that implements Serializable

    Hello everyone,
    Can someone please help me. I need to make a program that uses a class or servlet that implements Serializable and then use the values of the variables in servlets.
    The first is using it to validate login. then changing the color of the background, header and footer of each servlet.
    the variables in the Serialized file are all Strings for color, username, password, header text and footer text.
    I tried using the applet tag to run the class in the servlet but it is not working.

    It's not working because you seem to be making random guesses what servlets, serialization and files are

Maybe you are looking for

  • Delete Web Gallery or Journal in Aperture

    Greetings! I wish to completely delete a web gallery I have posted to my .mac account. If I delete the gallery in Aperture does it remove the pages from my .mac account? Do I have to do this manually somehow? I am not finding specific information in

  • Ora-01489: result of string concatenation is too long

    Hello Gurus, i have a typical problem i am constructing a query in FORM and writing SQLPLUS script into a .SQL file. file will contain final data like below.. set linesize 90 set pagesize 0 set echo off set verify off set termout off set feedback off

  • Export PDF that is totally CMYK compliant

    Hi, I'm using the PDFX1A settings when exporting from Indesign. My PDF is CMYK when any RGB images are used, which is what I want. But if I have an illustrator eps that uses spot colour (logo) linked to the the indesign document, that doesn't convert

  • Palm Sync and Snow Leopard

    Hi, I just upgraded to a Mac with Snow Leopard and realized that my Palm Centro no longer syncs. I looked at all the discussions online. I see that Apple isn't doing anything, Palm isn't doing anything, and I'm supposed to pay $40 for a new program t

  • Deletion logs

    Hi,       To check logs for the program /SAPAPO/RLCDELETE, I can go to SLG1 and give object name as APO: Supply Network Planning and subobject as Delete Transaction Data. How can I check the logs for program /SAPAPO/PPORDER_DEL in SLG1? I don't want