Is there an easy way to perform the following calculation?
String value = "921030022447967916"
a) Each alternating character is multiplied by 2 or 1
(i.e. 9*2, 2*1, 1*2...)
b) All digits are then summed:
9*2=18 or 1+8 + 2*1 or 2 + 1*2 or 2...)
I am new to this website and any help with this is greatly appreciated.
String value = "921030022447967916"
a) Each alternating character is multiplied by 2 or 1
(i.e. 9*2, 2*1, 1*2...)
b) All digits are then summed:
9*2=18 or 1+8 + 2*1 or 2 + 1*2 or 2...)
I am new to this website and any help with this is greatly appreciated.