Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Small problem with strings in java
New Posts  All Forums:Forum Nav:

Small problem with strings in java - Page 2

post #11 of 34
Quote:
Originally Posted by strangerfromisengard;15338307 
Can you please help me one more time? The method rangeCheck(String isbn) is always returning false. Can't understand why

sure. your problem is in this line
Code:
if(isbn.charAt(i)<0 || isbn.charAt(i)>9){
charAt() returns a char. iirc this is in ASCII format. numbers in ascii are 48-57, and 48 > 9 so it returns false.

to fix it try this:
Code:
public static boolean rangeCheck(String isbn){
  int i=0;
  if((isbn.charAt(9)>=0 && isbn.charAt(9)<10) || isbn.charAt(9)=='X'){
    while(i<9){
     [COLOR="Red"]int temp = Integer.parseInt(Character.toString(isbn.charAt(i)));[/COLOR]
      if([COLOR="Red"]temp[/COLOR]<0 || [COLOR="Red"]temp[/COLOR]>9){
        return false;
      }
      else{
        i++;
      }
    }
  }
  return true;
}

Edited by travesty - 10/16/11 at 11:40pm
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
post #12 of 34
Thread Starter 
Couldn't have been better. Thanks a ton!
First build
(13 items)
 
Pandoras Box
(13 items)
 
NV57H
(6 items)
 
CPUMotherboardGraphicsRAM
Phenom II X4 965 BE 4.0GHz @ 1.385V ASRock 970 Extreme 3 Gigabyte 650 Ti boost Mushkin Enhanced Silverline 4GB DDR3 1600 MHz 
RAMHard DriveOptical DriveCooling
Mushkin Enhanced Silverline 4GB DDR3 1600 MHz Seagate Barracuda 160GB  Samsung Noctua NH-D14 
MonitorPowerCaseMouse
Acer X223W Corsair VX550 Cooler Master Elite 430 TT E-Sports Theron 
Mouse Pad
Steelseries QcK Portal 2 
CPUMotherboardGraphicsRAM
E7500 @2.93 GHz Gigabyte G41M-ES2L Gigabyte HD 4650 2x 2 GB TwinMOS @ 800MHz 
Hard DriveOSMonitorPower
Samsung HD502IJ 500GB Windows 7 Ultimate 32-bit Samsung SyncMaster 943 18.5" Stock 450W 
Case
some piece of junk... 
CPUMotherboardGraphicsRAM
i3-2310M HM65 Intel HD 3000 6 GB DDR3 
Hard DriveOS
750 GB Windows 7 Home Premium x64 
  hide details  
Reply
First build
(13 items)
 
Pandoras Box
(13 items)
 
NV57H
(6 items)
 
CPUMotherboardGraphicsRAM
Phenom II X4 965 BE 4.0GHz @ 1.385V ASRock 970 Extreme 3 Gigabyte 650 Ti boost Mushkin Enhanced Silverline 4GB DDR3 1600 MHz 
RAMHard DriveOptical DriveCooling
Mushkin Enhanced Silverline 4GB DDR3 1600 MHz Seagate Barracuda 160GB  Samsung Noctua NH-D14 
MonitorPowerCaseMouse
Acer X223W Corsair VX550 Cooler Master Elite 430 TT E-Sports Theron 
Mouse Pad
Steelseries QcK Portal 2 
CPUMotherboardGraphicsRAM
E7500 @2.93 GHz Gigabyte G41M-ES2L Gigabyte HD 4650 2x 2 GB TwinMOS @ 800MHz 
Hard DriveOSMonitorPower
Samsung HD502IJ 500GB Windows 7 Ultimate 32-bit Samsung SyncMaster 943 18.5" Stock 450W 
Case
some piece of junk... 
CPUMotherboardGraphicsRAM
i3-2310M HM65 Intel HD 3000 6 GB DDR3 
Hard DriveOS
750 GB Windows 7 Home Premium x64 
  hide details  
Reply
post #13 of 34
glad to help
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
post #14 of 34
Thread Starter 
I'm almost done and there's(hopefully) one last problem that needs to be resolved. I've given below the entire code.
Quote:
public static void main(String[] args) {
String isbn="0590353403";
validateIsbn(isbn);
}public static boolean validateIsbn(String isbn){//validateIsbn method
boolean cond1=lengthCheck(isbn);//cond1 stores the boolean value from the lengthCheck method
if(cond1){//if cond1 is true, then the method stores the boolean value
boolean cond2=rangeCheck(isbn);//from rangeCheck into cond2
if(cond2){//if cond2 is true, then the method stores the boolean value
boolean cond3=checkSum(isbn);//from checkSum into cond3
if(cond1 && cond2 && cond3){//if each of cond1, cond2 and cond3 is true, the method returns true
return true;
}
else{
return false;
}
}
else{
return false;
}
}
else{
return false;
}
}
public static boolean lengthCheck(String isbn){//lengthCheck method which checks the length of the string
if(isbn.length()!=10){//If-else statement ensures that method returns false whenever
return false;//the length of the string is not 10
}
else{
return true;
}
}
public static boolean rangeCheck(String isbn){//rangeCheck method which checks the range of the digits in the string
int i=0;
if((isbn.charAt(9)>=0 && isbn.charAt(9)<10) || isbn.charAt(9)=='X'){//If-else statement checks that the 10th digit of the isbn is either 'X' or
while(i<9){//greater than 0 and less than 10
int temp = Integer.parseInt(Character.toString(isbn.charAt(i) ));//temp is used to store the integer value at the 'i'th position of the string using a for loop
if(temp<0 || temp>9){//If-else statement checks whether temp is less than zero or greater than 9
return false;//returns false if temp is outside the range
}
else{
i++;//the value of 'i' is incremented if the number is in the range
}
}
}
return true;//returns true only if the while loop is complete
}
public static boolean checkSum(String isbn){//checkSum method is used to validate the isbn number
int sum=0;//the 'sum' integer is declared
for(int i =0;i<9;i++){//for loop is declared
int x=Integer.parseInt(Character.toString(isbn.charAt( i)));//integer 'x' is used to store the integer value at the 'i'th position of the string
int y=(10-i);//integer 'y' stores the number with which each number from the isbn number is to be multiplied
sum=sum+(y*x);//sum is calculated using 'x' and 'y'
}
if((isbn.charAt(9)!='X') || (isbn.charAt(9)<0 || isbn.charAt(9)>9)){//if the 10th digit is neither 'X' nor in he range,
return false;//then the method returns false
}
else if(isbn.charAt(9)>=0 || isbn.charAt(9)<10){//if the 10th digit is between 0 and 9, the
sum=sum+(Integer.parseInt(Character.toString(isbn. charAt(9)))); //digit is added to 'sum'
}
else if(isbn.charAt(9)=='X'){//if the 10th character is 'X', then 10
sum=sum+10;//is added to 'sum'
}
if(sum%11==0){//If the remainder after dividing the sum by 11 is 0,
return true;//the method returns true
}
else{
return false;//else, the method returns false
}
}
}
now the problem is the method returns false when I enter the string "0590353403". The method works fine with all other values. What seems to be the problem? I understand that's a long code to go through but I'd really appreciate it if you could please help me. Hopefully, the annotation will help. Thanks in advance.
First build
(13 items)
 
Pandoras Box
(13 items)
 
NV57H
(6 items)
 
CPUMotherboardGraphicsRAM
Phenom II X4 965 BE 4.0GHz @ 1.385V ASRock 970 Extreme 3 Gigabyte 650 Ti boost Mushkin Enhanced Silverline 4GB DDR3 1600 MHz 
RAMHard DriveOptical DriveCooling
Mushkin Enhanced Silverline 4GB DDR3 1600 MHz Seagate Barracuda 160GB  Samsung Noctua NH-D14 
MonitorPowerCaseMouse
Acer X223W Corsair VX550 Cooler Master Elite 430 TT E-Sports Theron 
Mouse Pad
Steelseries QcK Portal 2 
CPUMotherboardGraphicsRAM
E7500 @2.93 GHz Gigabyte G41M-ES2L Gigabyte HD 4650 2x 2 GB TwinMOS @ 800MHz 
Hard DriveOSMonitorPower
Samsung HD502IJ 500GB Windows 7 Ultimate 32-bit Samsung SyncMaster 943 18.5" Stock 450W 
Case
some piece of junk... 
CPUMotherboardGraphicsRAM
i3-2310M HM65 Intel HD 3000 6 GB DDR3 
Hard DriveOS
750 GB Windows 7 Home Premium x64 
  hide details  
Reply
First build
(13 items)
 
Pandoras Box
(13 items)
 
NV57H
(6 items)
 
CPUMotherboardGraphicsRAM
Phenom II X4 965 BE 4.0GHz @ 1.385V ASRock 970 Extreme 3 Gigabyte 650 Ti boost Mushkin Enhanced Silverline 4GB DDR3 1600 MHz 
RAMHard DriveOptical DriveCooling
Mushkin Enhanced Silverline 4GB DDR3 1600 MHz Seagate Barracuda 160GB  Samsung Noctua NH-D14 
MonitorPowerCaseMouse
Acer X223W Corsair VX550 Cooler Master Elite 430 TT E-Sports Theron 
Mouse Pad
Steelseries QcK Portal 2 
CPUMotherboardGraphicsRAM
E7500 @2.93 GHz Gigabyte G41M-ES2L Gigabyte HD 4650 2x 2 GB TwinMOS @ 800MHz 
Hard DriveOSMonitorPower
Samsung HD502IJ 500GB Windows 7 Ultimate 32-bit Samsung SyncMaster 943 18.5" Stock 450W 
Case
some piece of junk... 
CPUMotherboardGraphicsRAM
i3-2310M HM65 Intel HD 3000 6 GB DDR3 
Hard DriveOS
750 GB Windows 7 Home Premium x64 
  hide details  
Reply
post #15 of 34
Which method is returning false?

I'm on my phone right now so I can't really dig through that code at the moment.

Any spot that you're comparing a character to an integer is a problem. I think I saw a few more of those in your code. Just use the code I posted before to fix those spots. Hopefully that will get you on the right track. If not I'll take another look at it later.
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
post #16 of 34
Thread Starter 
The checksum method is returning false. Something gets messed up when the last digit is being added to the sum
First build
(13 items)
 
Pandoras Box
(13 items)
 
NV57H
(6 items)
 
CPUMotherboardGraphicsRAM
Phenom II X4 965 BE 4.0GHz @ 1.385V ASRock 970 Extreme 3 Gigabyte 650 Ti boost Mushkin Enhanced Silverline 4GB DDR3 1600 MHz 
RAMHard DriveOptical DriveCooling
Mushkin Enhanced Silverline 4GB DDR3 1600 MHz Seagate Barracuda 160GB  Samsung Noctua NH-D14 
MonitorPowerCaseMouse
Acer X223W Corsair VX550 Cooler Master Elite 430 TT E-Sports Theron 
Mouse Pad
Steelseries QcK Portal 2 
CPUMotherboardGraphicsRAM
E7500 @2.93 GHz Gigabyte G41M-ES2L Gigabyte HD 4650 2x 2 GB TwinMOS @ 800MHz 
Hard DriveOSMonitorPower
Samsung HD502IJ 500GB Windows 7 Ultimate 32-bit Samsung SyncMaster 943 18.5" Stock 450W 
Case
some piece of junk... 
CPUMotherboardGraphicsRAM
i3-2310M HM65 Intel HD 3000 6 GB DDR3 
Hard DriveOS
750 GB Windows 7 Home Premium x64 
  hide details  
Reply
First build
(13 items)
 
Pandoras Box
(13 items)
 
NV57H
(6 items)
 
CPUMotherboardGraphicsRAM
Phenom II X4 965 BE 4.0GHz @ 1.385V ASRock 970 Extreme 3 Gigabyte 650 Ti boost Mushkin Enhanced Silverline 4GB DDR3 1600 MHz 
RAMHard DriveOptical DriveCooling
Mushkin Enhanced Silverline 4GB DDR3 1600 MHz Seagate Barracuda 160GB  Samsung Noctua NH-D14 
MonitorPowerCaseMouse
Acer X223W Corsair VX550 Cooler Master Elite 430 TT E-Sports Theron 
Mouse Pad
Steelseries QcK Portal 2 
CPUMotherboardGraphicsRAM
E7500 @2.93 GHz Gigabyte G41M-ES2L Gigabyte HD 4650 2x 2 GB TwinMOS @ 800MHz 
Hard DriveOSMonitorPower
Samsung HD502IJ 500GB Windows 7 Ultimate 32-bit Samsung SyncMaster 943 18.5" Stock 450W 
Case
some piece of junk... 
CPUMotherboardGraphicsRAM
i3-2310M HM65 Intel HD 3000 6 GB DDR3 
Hard DriveOS
750 GB Windows 7 Home Premium x64 
  hide details  
Reply
post #17 of 34
looks like you're having the same problem that you had in the other method. comparing chars to ints will never give you correct results. try making the changes in red.

Code:
public static boolean checkSum(String isbn){ //checkSum method is used to validate the isbn number
int sum=0; //the 'sum' integer is declared
for(int i =0;i<9;i++){ //for loop is declared
int x=Integer.parseInt(Character.toString(isbn.charAt( i))); //integer 'x' is used to store the integer value at the 'i'th position of the string
int y=(10-i); //integer 'y' stores the number with which each number from the isbn number is to be multiplied
sum=sum+(y*x); //sum is calculated using 'x' and 'y'
}
int temp = Integer.parseInt(Character.toString(isbn.charAt(9)));
if((isbn.charAt(9)!='X') || temp<0 || temp>9)){ //if the 10th digit is neither 'X' nor in he range,
return false; //then the method returns false
}
else if(temp>=0 || temp<10){ //if the 10th digit is between 0 and 9, the
sum=sum+(temp); //digit is added to 'sum'
}
else if(isbn.charAt(9)=='X'){ //if the 10th character is 'X', then 10
sum=sum+10; //is added to 'sum'
}
if(sum%11==0){ //If the remainder after dividing the sum by 11 is 0,
return true; //the method returns true
}
else{
return false; //else, the method returns false
}
}
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
post #18 of 34
Thread Starter 
I tried man...same error It says 'Exception in thread "main" java.lang.NumberFormatException: For input string: "x"
First build
(13 items)
 
Pandoras Box
(13 items)
 
NV57H
(6 items)
 
CPUMotherboardGraphicsRAM
Phenom II X4 965 BE 4.0GHz @ 1.385V ASRock 970 Extreme 3 Gigabyte 650 Ti boost Mushkin Enhanced Silverline 4GB DDR3 1600 MHz 
RAMHard DriveOptical DriveCooling
Mushkin Enhanced Silverline 4GB DDR3 1600 MHz Seagate Barracuda 160GB  Samsung Noctua NH-D14 
MonitorPowerCaseMouse
Acer X223W Corsair VX550 Cooler Master Elite 430 TT E-Sports Theron 
Mouse Pad
Steelseries QcK Portal 2 
CPUMotherboardGraphicsRAM
E7500 @2.93 GHz Gigabyte G41M-ES2L Gigabyte HD 4650 2x 2 GB TwinMOS @ 800MHz 
Hard DriveOSMonitorPower
Samsung HD502IJ 500GB Windows 7 Ultimate 32-bit Samsung SyncMaster 943 18.5" Stock 450W 
Case
some piece of junk... 
CPUMotherboardGraphicsRAM
i3-2310M HM65 Intel HD 3000 6 GB DDR3 
Hard DriveOS
750 GB Windows 7 Home Premium x64 
  hide details  
Reply
First build
(13 items)
 
Pandoras Box
(13 items)
 
NV57H
(6 items)
 
CPUMotherboardGraphicsRAM
Phenom II X4 965 BE 4.0GHz @ 1.385V ASRock 970 Extreme 3 Gigabyte 650 Ti boost Mushkin Enhanced Silverline 4GB DDR3 1600 MHz 
RAMHard DriveOptical DriveCooling
Mushkin Enhanced Silverline 4GB DDR3 1600 MHz Seagate Barracuda 160GB  Samsung Noctua NH-D14 
MonitorPowerCaseMouse
Acer X223W Corsair VX550 Cooler Master Elite 430 TT E-Sports Theron 
Mouse Pad
Steelseries QcK Portal 2 
CPUMotherboardGraphicsRAM
E7500 @2.93 GHz Gigabyte G41M-ES2L Gigabyte HD 4650 2x 2 GB TwinMOS @ 800MHz 
Hard DriveOSMonitorPower
Samsung HD502IJ 500GB Windows 7 Ultimate 32-bit Samsung SyncMaster 943 18.5" Stock 450W 
Case
some piece of junk... 
CPUMotherboardGraphicsRAM
i3-2310M HM65 Intel HD 3000 6 GB DDR3 
Hard DriveOS
750 GB Windows 7 Home Premium x64 
  hide details  
Reply
post #19 of 34
Thread Starter 
Here's the image:
Attachment 234393
First build
(13 items)
 
Pandoras Box
(13 items)
 
NV57H
(6 items)
 
CPUMotherboardGraphicsRAM
Phenom II X4 965 BE 4.0GHz @ 1.385V ASRock 970 Extreme 3 Gigabyte 650 Ti boost Mushkin Enhanced Silverline 4GB DDR3 1600 MHz 
RAMHard DriveOptical DriveCooling
Mushkin Enhanced Silverline 4GB DDR3 1600 MHz Seagate Barracuda 160GB  Samsung Noctua NH-D14 
MonitorPowerCaseMouse
Acer X223W Corsair VX550 Cooler Master Elite 430 TT E-Sports Theron 
Mouse Pad
Steelseries QcK Portal 2 
CPUMotherboardGraphicsRAM
E7500 @2.93 GHz Gigabyte G41M-ES2L Gigabyte HD 4650 2x 2 GB TwinMOS @ 800MHz 
Hard DriveOSMonitorPower
Samsung HD502IJ 500GB Windows 7 Ultimate 32-bit Samsung SyncMaster 943 18.5" Stock 450W 
Case
some piece of junk... 
CPUMotherboardGraphicsRAM
i3-2310M HM65 Intel HD 3000 6 GB DDR3 
Hard DriveOS
750 GB Windows 7 Home Premium x64 
  hide details  
Reply
First build
(13 items)
 
Pandoras Box
(13 items)
 
NV57H
(6 items)
 
CPUMotherboardGraphicsRAM
Phenom II X4 965 BE 4.0GHz @ 1.385V ASRock 970 Extreme 3 Gigabyte 650 Ti boost Mushkin Enhanced Silverline 4GB DDR3 1600 MHz 
RAMHard DriveOptical DriveCooling
Mushkin Enhanced Silverline 4GB DDR3 1600 MHz Seagate Barracuda 160GB  Samsung Noctua NH-D14 
MonitorPowerCaseMouse
Acer X223W Corsair VX550 Cooler Master Elite 430 TT E-Sports Theron 
Mouse Pad
Steelseries QcK Portal 2 
CPUMotherboardGraphicsRAM
E7500 @2.93 GHz Gigabyte G41M-ES2L Gigabyte HD 4650 2x 2 GB TwinMOS @ 800MHz 
Hard DriveOSMonitorPower
Samsung HD502IJ 500GB Windows 7 Ultimate 32-bit Samsung SyncMaster 943 18.5" Stock 450W 
Case
some piece of junk... 
CPUMotherboardGraphicsRAM
i3-2310M HM65 Intel HD 3000 6 GB DDR3 
Hard DriveOS
750 GB Windows 7 Home Premium x64 
  hide details  
Reply
post #20 of 34
Quote:
Originally Posted by strangerfromisengard View Post
I tried man...same error It says 'Exception in thread "main" java.lang.NumberFormatException: For input string: "x"
which line is the error on?
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Small problem with strings in java