Best code to compare Two large Numbers,in Java/Android



///code to call a method if the value in array is greater than the given value.
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dummy);.
        String imageDates[]={"0105301213360198655510.jpg","010520121336019865556.jpg","010520121336019865557.jpg","010520121336019865558.jpg"
                ,"010520121336019865559.jpg","0105201213360198655510.jpg"};
        String myImgName="010520121336019865558.jpg";
        BigInteger notSoBig = new BigInteger(new StringTokenizer(myImgName, ".jpg").nextToken());//for removing .jpg extention from number
        for(int i=0;i<imageDates.length;i++)
        {
           
            BigInteger reallyBig = new BigInteger(new StringTokenizer(imageDates[i], ".jpg").nextToken());//for removing .jpg extention from number
           
            if(!notSoBig.equals(imageDates[i])){//if Both strings r equal control not enters into if condition
            reallyBig = reallyBig.max(notSoBig);//returns Big value
           
            if(!reallyBig.equals(notSoBig)){//if Both are not equal then we got max value from array
            System.out.println("=====reallyBig value=="+reallyBig);
            System.out.println("=====arrayBig value=="+imageDates[i]);
            myMethod(imageDates[i]);
            }//inner-if
           
            }//outer-if
           
           
        }//for
       
       
               
    }///onCreate()..
   
   
    private void myMethod(String myImgName) {
        // TODO Auto-generated method stub
       
    }

Comments

Popular posts from this blog

Custom Dialog with no title and full screen in Android

Best working code to set Date limits on Date Picker Dialog,in Android

code to display .pdf,.text,.DOC,.DOCX,.doc extension files exists in SDCard