fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone {
  9. public static void main (String[] args) throws java.lang.Exception {
  10. System.out.format("bengaliToArabic('১') == %s // char\n", bengaliToArabic('১'));
  11. System.out.format("bengaliToInt('১') == %s // int\n", bengaliToInt('১'));
  12. }
  13.  
  14. /**
  15.   *
  16.   * Convert a bengali numeral to its arabic equivalent numeral.
  17.   *
  18.   * @param bengaliNumeral bengali numeral to be converted
  19.   *
  20.   * @return the equivalent Arabic numeral
  21.   * @see #bengaliToInt
  22.   */
  23. public static char bengaliToArabic(char bengaliNumeral) {
  24. return (char) (bengaliNumeral - '০' + '0');
  25. }
  26.  
  27. public static int bengaliToInt(char bengaliNumeral) {
  28. return Character.getNumericValue(bengaliNumeral);
  29. }
  30. }
Success #stdin #stdout 0.13s 320576KB
stdin
Standard input is empty
stdout
bengaliToArabic('১') == 1 // char
bengaliToInt('১')    == 1 // int