You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NumberConverterTestCase.java 48KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.complexscripts.util;
  19. import java.util.ArrayList;
  20. import java.util.List;
  21. import org.junit.Test;
  22. import static org.junit.Assert.assertEquals;
  23. // CSOFF: LineLengthCheck
  24. /**
  25. * Test number converter functionality.
  26. */
  27. public class NumberConverterTestCase {
  28. private static String[][] formatDecimal =
  29. {
  30. { "1" },
  31. { "0", "0" },
  32. { "1", "1" },
  33. { "1000", "1000" },
  34. { "1000000", "1000000" },
  35. { "1000000000", "1000000000" },
  36. };
  37. private static String[][] formatDecimalPadded =
  38. {
  39. { "001" },
  40. { "0", "000" },
  41. { "1", "001" },
  42. { "9", "009" },
  43. { "10", "010" },
  44. { "99", "099" },
  45. { "100", "100" },
  46. { "999", "999" },
  47. { "1000", "1000" },
  48. };
  49. private static String[][] formatDecimalGrouped =
  50. {
  51. { "1", ",", "1" },
  52. { "0", "0" },
  53. { "1", "1" },
  54. { "1000", "1,0,0,0" },
  55. { "1000000", "1,0,0,0,0,0,0" },
  56. { "1000000000", "1,0,0,0,0,0,0,0,0,0" },
  57. };
  58. private static String[][] formatDecimalGroupedPadded =
  59. {
  60. { "001", ",", "2" },
  61. { "0", "0,00" },
  62. { "1", "0,01" },
  63. { "9", "0,09" },
  64. { "10", "0,10" },
  65. { "99", "0,99" },
  66. { "100", "1,00" },
  67. { "999", "9,99" },
  68. { "1000", "10,00" },
  69. };
  70. private static String[][] formatDecimalArabic =
  71. {
  72. { "\u0661" },
  73. { "0", "\u0660" },
  74. { "1", "\u0661" },
  75. { "2", "\u0662" },
  76. { "3", "\u0663" },
  77. { "4", "\u0664" },
  78. { "5", "\u0665" },
  79. { "6", "\u0666" },
  80. { "7", "\u0667" },
  81. { "8", "\u0668" },
  82. { "9", "\u0669" },
  83. { "10", "\u0661\u0660" },
  84. { "1000", "\u0661\u0660\u0660\u0660" },
  85. { "1000000", "\u0661\u0660\u0660\u0660\u0660\u0660\u0660" },
  86. { "1000000000", "\u0661\u0660\u0660\u0660\u0660\u0660\u0660\u0660\u0660\u0660" },
  87. };
  88. private static String[][] formatDecimalArabicPadded =
  89. {
  90. { "\u0660\u0660\u0661" },
  91. { "0", "\u0660\u0660\u0660" },
  92. { "1", "\u0660\u0660\u0661" },
  93. { "9", "\u0660\u0660\u0669" },
  94. { "10", "\u0660\u0661\u0660" },
  95. { "99", "\u0660\u0669\u0669" },
  96. { "100", "\u0661\u0660\u0660" },
  97. { "999", "\u0669\u0669\u0669" },
  98. { "1000", "\u0661\u0660\u0660\u0660" },
  99. };
  100. private static String[][] formatDecimalArabicGrouped =
  101. {
  102. { "\u0661", "\u066c", "1" },
  103. { "0", "\u0660" },
  104. { "1", "\u0661" },
  105. { "1000", "\u0661\u066c\u0660\u066c\u0660\u066c\u0660" },
  106. { "1000000", "\u0661\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660" },
  107. { "1000000000", "\u0661\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660" },
  108. };
  109. private static String[][] formatDecimalArabicGroupedPadded =
  110. {
  111. { "\u0660\u0660\u0661", "\u066c", "2" },
  112. { "0", "\u0660\u066c\u0660\u0660" },
  113. { "1", "\u0660\u066c\u0660\u0661" },
  114. { "9", "\u0660\u066c\u0660\u0669" },
  115. { "10", "\u0660\u066c\u0661\u0660" },
  116. { "99", "\u0660\u066c\u0669\u0669" },
  117. { "100", "\u0661\u066c\u0660\u0660" },
  118. { "999", "\u0669\u066c\u0669\u0669" },
  119. { "1000", "\u0661\u0660\u066c\u0660\u0660" },
  120. };
  121. private static String[][] formatDecimalThai =
  122. {
  123. { "\u0E51" },
  124. { "0", "\u0E50" },
  125. { "1", "\u0E51" },
  126. { "2", "\u0E52" },
  127. { "3", "\u0E53" },
  128. { "4", "\u0E54" },
  129. { "5", "\u0E55" },
  130. { "6", "\u0E56" },
  131. { "7", "\u0E57" },
  132. { "8", "\u0E58" },
  133. { "9", "\u0E59" },
  134. { "10", "\u0E51\u0E50" },
  135. { "1000", "\u0E51\u0E50\u0E50\u0E50" },
  136. { "1000000", "\u0E51\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50" },
  137. { "1000000000", "\u0E51\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50" },
  138. };
  139. private static String[][] formatDecimalThaiPadded =
  140. {
  141. { "\u0E50\u0E50\u0E51" },
  142. { "0", "\u0E50\u0E50\u0E50" },
  143. { "1", "\u0E50\u0E50\u0E51" },
  144. { "9", "\u0E50\u0E50\u0E59" },
  145. { "10", "\u0E50\u0E51\u0E50" },
  146. { "99", "\u0E50\u0E59\u0E59" },
  147. { "100", "\u0E51\u0E50\u0E50" },
  148. { "999", "\u0E59\u0E59\u0E59" },
  149. { "1000", "\u0E51\u0E50\u0E50\u0E50" },
  150. };
  151. private static String[][] formatRomanLower =
  152. {
  153. { "i" },
  154. { "0", "0" },
  155. { "1", "i" },
  156. { "2", "ii" },
  157. { "3", "iii" },
  158. { "4", "iv" },
  159. { "5", "v" },
  160. { "6", "vi" },
  161. { "7", "vii" },
  162. { "8", "viii" },
  163. { "9", "ix" },
  164. { "10", "x" },
  165. { "20", "xx" },
  166. { "30", "xxx" },
  167. { "40", "xl" },
  168. { "50", "l" },
  169. { "60", "lx" },
  170. { "70", "lxx" },
  171. { "80", "lxxx" },
  172. { "90", "xc" },
  173. { "100", "c" },
  174. { "200", "cc" },
  175. { "300", "ccc" },
  176. { "400", "cd" },
  177. { "500", "d" },
  178. { "600", "dc" },
  179. { "700", "dcc" },
  180. { "800", "dccc" },
  181. { "900", "cm" },
  182. { "1000", "m" },
  183. { "2000", "mm" },
  184. { "2011", "mmxi" },
  185. { "4999", "mmmmcmxcix" },
  186. { "5000", "5000" },
  187. };
  188. private static String[][] formatRomanUpper =
  189. {
  190. { "I" },
  191. { "0", "0" },
  192. { "1", "I" },
  193. { "2", "II" },
  194. { "3", "III" },
  195. { "4", "IV" },
  196. { "5", "V" },
  197. { "6", "VI" },
  198. { "7", "VII" },
  199. { "8", "VIII" },
  200. { "9", "IX" },
  201. { "10", "X" },
  202. { "20", "XX" },
  203. { "30", "XXX" },
  204. { "40", "XL" },
  205. { "50", "L" },
  206. { "60", "LX" },
  207. { "70", "LXX" },
  208. { "80", "LXXX" },
  209. { "90", "XC" },
  210. { "100", "C" },
  211. { "200", "CC" },
  212. { "300", "CCC" },
  213. { "400", "CD" },
  214. { "500", "D" },
  215. { "600", "DC" },
  216. { "700", "DCC" },
  217. { "800", "DCCC" },
  218. { "900", "CM" },
  219. { "1000", "M" },
  220. { "2000", "MM" },
  221. { "2011", "MMXI" },
  222. { "4999", "MMMMCMXCIX" },
  223. { "5000", "5000" },
  224. };
  225. private static String[][] formatRomanLargeLower =
  226. {
  227. { "i", null, null, null, "large" },
  228. { "0", "0" },
  229. { "1", "i" },
  230. { "2", "ii" },
  231. { "3", "iii" },
  232. { "4", "iv" },
  233. { "5", "v" },
  234. { "6", "vi" },
  235. { "7", "vii" },
  236. { "8", "viii" },
  237. { "9", "ix" },
  238. { "10", "x" },
  239. { "20", "xx" },
  240. { "30", "xxx" },
  241. { "40", "xl" },
  242. { "50", "l" },
  243. { "60", "lx" },
  244. { "70", "lxx" },
  245. { "80", "lxxx" },
  246. { "90", "xc" },
  247. { "100", "c" },
  248. { "200", "cc" },
  249. { "300", "ccc" },
  250. { "400", "cd" },
  251. { "500", "d" },
  252. { "600", "dc" },
  253. { "700", "dcc" },
  254. { "800", "dccc" },
  255. { "900", "cm" },
  256. { "1000", "m" },
  257. { "2000", "mm" },
  258. { "2011", "mmxi" },
  259. { "4999", "\u2180\u2181cmxcix" },
  260. { "5000", "\u2181" },
  261. { "5001", "\u2181i" },
  262. { "9999", "\u2180\u2182cmxcix" },
  263. { "10000", "\u2182" },
  264. { "10001", "\u2182i" },
  265. { "49999", "\u2182\u2187\u2180\u2182cmxcix" },
  266. { "99999", "\u2182\u2188\u2180\u2182cmxcix" },
  267. { "100000", "\u2188" },
  268. { "100001", "\u2188i" },
  269. { "199999", "\u2188\u2182\u2188\u2180\u2182cmxcix" },
  270. { "200000", "200000" },
  271. };
  272. private static String[][] formatRomanLargeUpper =
  273. {
  274. { "I", null, null, null, "large" },
  275. { "0", "0" },
  276. { "1", "I" },
  277. { "2", "II" },
  278. { "3", "III" },
  279. { "4", "IV" },
  280. { "5", "V" },
  281. { "6", "VI" },
  282. { "7", "VII" },
  283. { "8", "VIII" },
  284. { "9", "IX" },
  285. { "10", "X" },
  286. { "20", "XX" },
  287. { "30", "XXX" },
  288. { "40", "XL" },
  289. { "50", "L" },
  290. { "60", "LX" },
  291. { "70", "LXX" },
  292. { "80", "LXXX" },
  293. { "90", "XC" },
  294. { "100", "C" },
  295. { "200", "CC" },
  296. { "300", "CCC" },
  297. { "400", "CD" },
  298. { "500", "D" },
  299. { "600", "DC" },
  300. { "700", "DCC" },
  301. { "800", "DCCC" },
  302. { "900", "CM" },
  303. { "1000", "M" },
  304. { "2000", "MM" },
  305. { "2011", "MMXI" },
  306. { "4999", "\u2180\u2181CMXCIX" },
  307. { "5000", "\u2181" },
  308. { "5001", "\u2181I" },
  309. { "9999", "\u2180\u2182CMXCIX" },
  310. { "10000", "\u2182" },
  311. { "10001", "\u2182I" },
  312. { "49999", "\u2182\u2187\u2180\u2182CMXCIX" },
  313. { "99999", "\u2182\u2188\u2180\u2182CMXCIX" },
  314. { "100000", "\u2188" },
  315. { "100001", "\u2188I" },
  316. { "199999", "\u2188\u2182\u2188\u2180\u2182CMXCIX" },
  317. { "200000", "200000" },
  318. };
  319. private static String[][] formatRomanNumberFormsLower =
  320. {
  321. { "i", null, null, null, "unicode-number-forms" },
  322. { "0", "0" },
  323. { "1", "\u2170" },
  324. { "2", "\u2171" },
  325. { "3", "\u2172" },
  326. { "4", "\u2173" },
  327. { "5", "\u2174" },
  328. { "6", "\u2175" },
  329. { "7", "\u2176" },
  330. { "8", "\u2177" },
  331. { "9", "\u2178" },
  332. { "10", "\u2179" },
  333. { "11", "\u2179\u2170" },
  334. { "12", "\u2179\u2171" },
  335. { "13", "\u2179\u2172" },
  336. { "14", "\u2179\u2173" },
  337. { "15", "\u2179\u2174" },
  338. { "16", "\u2179\u2175" },
  339. { "17", "\u2179\u2176" },
  340. { "18", "\u2179\u2177" },
  341. { "19", "\u2179\u2178" },
  342. { "20", "\u2179\u2179" },
  343. { "30", "\u2179\u2179\u2179" },
  344. { "40", "\u2179\u217C" },
  345. { "50", "\u217C" },
  346. { "60", "\u217C\u2179" },
  347. { "70", "\u217C\u2179\u2179" },
  348. { "80", "\u217C\u2179\u2179\u2179" },
  349. { "90", "\u2179\u217D" },
  350. { "100", "\u217D" },
  351. { "200", "\u217D\u217D" },
  352. { "300", "\u217D\u217D\u217D" },
  353. { "400", "\u217D\u217E" },
  354. { "500", "\u217E" },
  355. { "600", "\u217E\u217D" },
  356. { "700", "\u217E\u217D\u217D" },
  357. { "800", "\u217E\u217D\u217D\u217D" },
  358. { "900", "\u217D\u217F" },
  359. { "999", "\u217D\u217F\u2179\u217D\u2178" },
  360. { "1000", "\u217F" },
  361. { "2000", "\u217F\u217F" },
  362. { "2011", "\u217F\u217F\u2179\u2170" },
  363. { "4999", "\u2180\u2181\u217D\u217F\u2179\u217D\u2178" },
  364. { "5000", "\u2181" },
  365. { "5001", "\u2181\u2170" },
  366. { "9999", "\u2180\u2182\u217D\u217F\u2179\u217D\u2178" },
  367. { "10000", "\u2182" },
  368. { "10001", "\u2182\u2170" },
  369. { "49999", "\u2182\u2187\u2180\u2182\u217D\u217F\u2179\u217D\u2178" },
  370. { "99999", "\u2182\u2188\u2180\u2182\u217D\u217F\u2179\u217D\u2178" },
  371. { "100000", "\u2188" },
  372. { "100001", "\u2188\u2170" },
  373. { "199999", "\u2188\u2182\u2188\u2180\u2182\u217D\u217F\u2179\u217D\u2178" },
  374. { "200000", "200000" },
  375. };
  376. private static String[][] formatRomanNumberFormsUpper =
  377. {
  378. { "I", null, null, null, "unicode-number-forms" },
  379. { "0", "0" },
  380. { "1", "\u2160" },
  381. { "2", "\u2161" },
  382. { "3", "\u2162" },
  383. { "4", "\u2163" },
  384. { "5", "\u2164" },
  385. { "6", "\u2165" },
  386. { "7", "\u2166" },
  387. { "8", "\u2167" },
  388. { "9", "\u2168" },
  389. { "10", "\u2169" },
  390. { "11", "\u2169\u2160" },
  391. { "12", "\u2169\u2161" },
  392. { "13", "\u2169\u2162" },
  393. { "14", "\u2169\u2163" },
  394. { "15", "\u2169\u2164" },
  395. { "16", "\u2169\u2165" },
  396. { "17", "\u2169\u2166" },
  397. { "18", "\u2169\u2167" },
  398. { "19", "\u2169\u2168" },
  399. { "20", "\u2169\u2169" },
  400. { "30", "\u2169\u2169\u2169" },
  401. { "40", "\u2169\u216C" },
  402. { "50", "\u216C" },
  403. { "60", "\u216C\u2169" },
  404. { "70", "\u216C\u2169\u2169" },
  405. { "80", "\u216C\u2169\u2169\u2169" },
  406. { "90", "\u2169\u216D" },
  407. { "100", "\u216D" },
  408. { "200", "\u216D\u216D" },
  409. { "300", "\u216D\u216D\u216D" },
  410. { "400", "\u216D\u216E" },
  411. { "500", "\u216E" },
  412. { "600", "\u216E\u216D" },
  413. { "700", "\u216E\u216D\u216D" },
  414. { "800", "\u216E\u216D\u216D\u216D" },
  415. { "900", "\u216D\u216F" },
  416. { "999", "\u216D\u216F\u2169\u216D\u2168" },
  417. { "1000", "\u216F" },
  418. { "2000", "\u216F\u216F" },
  419. { "2011", "\u216F\u216F\u2169\u2160" },
  420. { "4999", "\u2180\u2181\u216D\u216F\u2169\u216D\u2168" },
  421. { "5000", "\u2181" },
  422. { "5001", "\u2181\u2160" },
  423. { "9999", "\u2180\u2182\u216D\u216F\u2169\u216D\u2168" },
  424. { "10000", "\u2182" },
  425. { "10001", "\u2182\u2160" },
  426. { "49999", "\u2182\u2187\u2180\u2182\u216D\u216F\u2169\u216D\u2168" },
  427. { "99999", "\u2182\u2188\u2180\u2182\u216D\u216F\u2169\u216D\u2168" },
  428. { "100000", "\u2188" },
  429. { "100001", "\u2188\u2160" },
  430. { "199999", "\u2188\u2182\u2188\u2180\u2182\u216D\u216F\u2169\u216D\u2168" },
  431. { "200000", "200000" },
  432. };
  433. private static String[][] formatAlphabeticLatinLower =
  434. {
  435. { "a" },
  436. { "0", "0" },
  437. { "1", "a" },
  438. { "2", "b" },
  439. { "3", "c" },
  440. { "10", "j" },
  441. { "20", "t" },
  442. { "26", "z" },
  443. { "27", "aa" },
  444. { "28", "ab" },
  445. { "29", "ac" },
  446. { "52", "az" },
  447. { "53", "ba" },
  448. { "702", "zz" },
  449. { "703", "aaa" },
  450. { "999999", "bdwgm" },
  451. { "1000000", "bdwgn" },
  452. };
  453. private static String[][] formatAlphabeticLatinUpper =
  454. {
  455. { "A" },
  456. { "0", "0" },
  457. { "1", "A" },
  458. { "2", "B" },
  459. { "3", "C" },
  460. { "10", "J" },
  461. { "20", "T" },
  462. { "26", "Z" },
  463. { "27", "AA" },
  464. { "28", "AB" },
  465. { "29", "AC" },
  466. { "52", "AZ" },
  467. { "53", "BA" },
  468. { "702", "ZZ" },
  469. { "703", "AAA" },
  470. { "999999", "BDWGM" },
  471. { "1000000", "BDWGN" },
  472. };
  473. private static String[][] formatAlphabeticArabicHijai =
  474. {
  475. { "\u0627", null, null, "alphabetic" },
  476. { "0", "0" },
  477. { "1", "\u0623" },
  478. { "2", "\u0628" },
  479. { "3", "\u062A" },
  480. { "4", "\u062B" },
  481. { "5", "\u062C" },
  482. { "6", "\u062D" },
  483. { "7", "\u062E" },
  484. { "8", "\u062F" },
  485. { "9", "\u0630" },
  486. { "10", "\u0631" },
  487. { "11", "\u0632" },
  488. { "12", "\u0633" },
  489. { "13", "\u0634" },
  490. { "14", "\u0635" },
  491. { "15", "\u0636" },
  492. { "16", "\u0637" },
  493. { "17", "\u0638" },
  494. { "18", "\u0639" },
  495. { "19", "\u063A" },
  496. { "20", "\u0641" },
  497. { "21", "\u0642" },
  498. { "22", "\u0643" },
  499. { "23", "\u0644" },
  500. { "24", "\u0645" },
  501. { "25", "\u0646" },
  502. { "26", "\u0647" },
  503. { "27", "\u0648" },
  504. { "28", "\u0649" },
  505. { "29", "\u0623\u0623" },
  506. { "56", "\u0623\u0649" },
  507. { "57", "\u0628\u0623" },
  508. { "812", "\u0649\u0649" },
  509. { "813", "\u0623\u0623\u0623" },
  510. { "999999", "\u0623\u0638\u0636\u0635\u062E" },
  511. { "1000000", "\u0623\u0638\u0636\u0635\u062F" },
  512. };
  513. private static String[][] formatAlphabeticArabicAbjadi =
  514. {
  515. { "\u0627", null, null, "traditional" },
  516. { "0", "0" },
  517. { "1", "\u0623" },
  518. { "2", "\u0628" },
  519. { "3", "\u062C" },
  520. { "4", "\u062F" },
  521. { "5", "\u0647" },
  522. { "6", "\u0648" },
  523. { "7", "\u0632" },
  524. { "8", "\u062D" },
  525. { "9", "\u0637" },
  526. { "10", "\u0649" },
  527. { "11", "\u0643" },
  528. { "12", "\u0644" },
  529. { "13", "\u0645" },
  530. { "14", "\u0646" },
  531. { "15", "\u0633" },
  532. { "16", "\u0639" },
  533. { "17", "\u0641" },
  534. { "18", "\u0635" },
  535. { "19", "\u0642" },
  536. { "20", "\u0631" },
  537. { "21", "\u0634" },
  538. { "22", "\u062A" },
  539. { "23", "\u062B" },
  540. { "24", "\u062E" },
  541. { "25", "\u0630" },
  542. { "26", "\u0636" },
  543. { "27", "\u0638" },
  544. { "28", "\u063A" },
  545. { "29", "\u0623\u0623" },
  546. { "56", "\u0623\u063A" },
  547. { "57", "\u0628\u0623" },
  548. { "812", "\u063A\u063A" },
  549. { "813", "\u0623\u0623\u0623" },
  550. { "999999", "\u0623\u0641\u0633\u0646\u0632" },
  551. { "1000000", "\u0623\u0641\u0633\u0646\u062D" },
  552. };
  553. private static String[][] formatNumeralArabicAbjadi =
  554. {
  555. { "\u0623", null, null, "traditional" },
  556. { "0", "0" },
  557. { "1", "\u0623" },
  558. { "2", "\u0628" },
  559. { "3", "\u062C" },
  560. { "4", "\u062F" },
  561. { "5", "\u0647" },
  562. { "6", "\u0648" },
  563. { "7", "\u0632" },
  564. { "8", "\u062D" },
  565. { "9", "\u0637" },
  566. { "10", "\u0649" },
  567. { "11", "\u0649\u0623" },
  568. { "12", "\u0649\u0628" },
  569. { "13", "\u0649\u062C" },
  570. { "14", "\u0649\u062F" },
  571. { "15", "\u0649\u0647" },
  572. { "16", "\u0649\u0648" },
  573. { "17", "\u0649\u0632" },
  574. { "18", "\u0649\u062D" },
  575. { "19", "\u0649\u0637" },
  576. { "20", "\u0643" },
  577. { "30", "\u0644" },
  578. { "40", "\u0645" },
  579. { "50", "\u0646" },
  580. { "60", "\u0633" },
  581. { "70", "\u0639" },
  582. { "80", "\u0641" },
  583. { "90", "\u0635" },
  584. { "99", "\u0635\u0637" },
  585. { "100", "\u0642" },
  586. { "101", "\u0642\u0623" },
  587. { "200", "\u0631" },
  588. { "300", "\u0634" },
  589. { "400", "\u062A" },
  590. { "500", "\u062B" },
  591. { "600", "\u062E" },
  592. { "700", "\u0630" },
  593. { "800", "\u0636" },
  594. { "900", "\u0638" },
  595. { "999", "\u0638\u0635\u0637" },
  596. { "1000", "\u063A" },
  597. { "1999", "\u063A\u0638\u0635\u0637" },
  598. { "2000", "2000" },
  599. };
  600. private static String[][] formatAlphabeticHebrew =
  601. {
  602. { "\u05D0", null, null, "alphabetic" },
  603. { "0", "0" },
  604. { "1", "\u05D0" },
  605. { "2", "\u05D1" },
  606. { "3", "\u05D2" },
  607. { "4", "\u05D3" },
  608. { "5", "\u05D4" },
  609. { "6", "\u05D5" },
  610. { "7", "\u05D6" },
  611. { "8", "\u05D7" },
  612. { "9", "\u05D8" },
  613. { "10", "\u05D9" },
  614. { "11", "\u05DB" },
  615. { "12", "\u05DC" },
  616. { "13", "\u05DE" },
  617. { "14", "\u05E0" },
  618. { "15", "\u05E1" },
  619. { "16", "\u05E2" },
  620. { "17", "\u05E4" },
  621. { "18", "\u05E6" },
  622. { "19", "\u05E7" },
  623. { "20", "\u05E8" },
  624. { "21", "\u05E9" },
  625. { "22", "\u05EA" },
  626. { "23", "\u05DA" },
  627. { "24", "\u05DD" },
  628. { "25", "\u05DF" },
  629. { "26", "\u05E3" },
  630. { "27", "\u05E5" },
  631. { "28", "\u05D0\u05D0" },
  632. { "54", "\u05D0\u05E5" },
  633. { "55", "\u05D1\u05D0" },
  634. { "756", "\u05E5\u05E5" },
  635. { "757", "\u05D0\u05D0\u05D0" },
  636. { "999999", "\u05D0\u05DA\u05E9\u05E7\u05E5" },
  637. { "1000000", "\u05D0\u05DA\u05E9\u05E8\u05D0" },
  638. };
  639. private static String[][] formatNumeralHebrewGematria =
  640. {
  641. { "\u05D0", null, null, "traditional" },
  642. { "0", "0" },
  643. { "1", "\u05D0" },
  644. { "2", "\u05D1" },
  645. { "3", "\u05D2" },
  646. { "4", "\u05D3" },
  647. { "5", "\u05D4" },
  648. { "6", "\u05D5" },
  649. { "7", "\u05D6" },
  650. { "8", "\u05D7" },
  651. { "9", "\u05D8" },
  652. { "10", "\u05D9" },
  653. { "11", "\u05D9\u05D0" },
  654. { "12", "\u05D9\u05D1" },
  655. { "13", "\u05D9\u05D2" },
  656. { "14", "\u05D9\u05D3" },
  657. { "15", "\u05D8\u05F4\u05D5" },
  658. { "16", "\u05D8\u05F4\u05D6" },
  659. { "17", "\u05D9\u05D6" },
  660. { "18", "\u05D9\u05D7" },
  661. { "19", "\u05D9\u05D8" },
  662. { "20", "\u05DB" },
  663. { "30", "\u05DC" },
  664. { "40", "\u05DE" },
  665. { "50", "\u05E0" },
  666. { "60", "\u05E1" },
  667. { "70", "\u05E2" },
  668. { "80", "\u05E4" },
  669. { "90", "\u05E6" },
  670. { "99", "\u05E6\u05D8" },
  671. { "100", "\u05E7" },
  672. { "101", "\u05E7\u05D0" },
  673. { "200", "\u05E8" },
  674. { "300", "\u05E9" },
  675. { "400", "\u05EA" },
  676. { "500", "\u05EA\u05F4\u05E7" },
  677. { "600", "\u05EA\u05F4\u05E8" },
  678. { "700", "\u05EA\u05F4\u05E9" },
  679. { "800", "\u05EA\u05F4\u05EA" },
  680. { "900", "\u05EA\u05EA\u05F4\u05E7" },
  681. { "999", "\u05EA\u05EA\u05F4\u05E7\u05E6\u05D8" },
  682. { "1000", "\u05D0\u05F3" },
  683. { "1999", "\u05D0\u05F3\u05EA\u05EA\u05F4\u05E7\u05E6\u05D8" },
  684. { "2000", "2000" },
  685. };
  686. private static String[][] formatAlphabeticThai =
  687. {
  688. { "\u0E01", null, null, "alphabetic" },
  689. { "0", "0" },
  690. { "1", "\u0E01" },
  691. { "2", "\u0E02" },
  692. { "3", "\u0E03" },
  693. { "10", "\u0E0A" },
  694. { "20", "\u0E14" },
  695. { "30", "\u0E1E" },
  696. { "40", "\u0E2A" },
  697. { "44", "\u0E2E" },
  698. { "45", "\u0E01\u0E01" },
  699. { "88", "\u0E01\u0E2E" },
  700. { "89", "\u0E02\u0E01" },
  701. { "1980", "\u0E2E\u0E2E" },
  702. { "1981", "\u0E01\u0E01\u0E01" },
  703. { "999999", "\u0E0B\u0E20\u0E17\u0E0B" },
  704. { "1000000", "\u0E0B\u0E20\u0E17\u0E0C" },
  705. };
  706. private static String[][] formatWordEnglishLower =
  707. {
  708. { "w", null, null, null, null, "eng" },
  709. { "0", "zero" },
  710. { "1", "one" },
  711. { "2", "two" },
  712. { "3", "three" },
  713. { "4", "four" },
  714. { "5", "five" },
  715. { "6", "six" },
  716. { "7", "seven" },
  717. { "8", "eight" },
  718. { "9", "nine" },
  719. { "10", "ten" },
  720. { "99", "ninety nine" },
  721. { "100", "one hundred" },
  722. { "999", "nine hundred ninety nine" },
  723. { "1000", "one thousand" },
  724. { "999999", "nine hundred ninety nine thousand nine hundred ninety nine" },
  725. { "1000000", "one million" },
  726. { "999999999", "nine hundred ninety nine million nine hundred ninety nine thousand nine hundred ninety nine" },
  727. { "1000000000", "one billion" }
  728. };
  729. private static String[][] formatWordEnglishUpper =
  730. {
  731. { "W", null, null, null, null, "eng" },
  732. { "0", "ZERO" },
  733. { "1", "ONE" },
  734. { "2", "TWO" },
  735. { "3", "THREE" },
  736. { "4", "FOUR" },
  737. { "5", "FIVE" },
  738. { "6", "SIX" },
  739. { "7", "SEVEN" },
  740. { "8", "EIGHT" },
  741. { "9", "NINE" },
  742. { "10", "TEN" },
  743. { "99", "NINETY NINE" },
  744. { "100", "ONE HUNDRED" },
  745. { "999", "NINE HUNDRED NINETY NINE" },
  746. { "1000", "ONE THOUSAND" },
  747. { "999999", "NINE HUNDRED NINETY NINE THOUSAND NINE HUNDRED NINETY NINE" },
  748. { "1000000", "ONE MILLION" },
  749. { "999999999", "NINE HUNDRED NINETY NINE MILLION NINE HUNDRED NINETY NINE THOUSAND NINE HUNDRED NINETY NINE" },
  750. { "1000000000", "ONE BILLION" }
  751. };
  752. private static String[][] formatWordEnglishTitle =
  753. {
  754. { "Ww", null, null, null, null, "eng" },
  755. { "0", "Zero" },
  756. { "1", "One" },
  757. { "2", "Two" },
  758. { "3", "Three" },
  759. { "4", "Four" },
  760. { "5", "Five" },
  761. { "6", "Six" },
  762. { "7", "Seven" },
  763. { "8", "Eight" },
  764. { "9", "Nine" },
  765. { "10", "Ten" },
  766. { "99", "Ninety Nine" },
  767. { "100", "One Hundred" },
  768. { "999", "Nine Hundred Ninety Nine" },
  769. { "1000", "One Thousand" },
  770. { "999999", "Nine Hundred Ninety Nine Thousand Nine Hundred Ninety Nine" },
  771. { "1000000", "One Million" },
  772. { "999999999", "Nine Hundred Ninety Nine Million Nine Hundred Ninety Nine Thousand Nine Hundred Ninety Nine" },
  773. { "1000000000", "One Billion" }
  774. };
  775. private static String[][] formatWordSpanishLower =
  776. {
  777. { "w", null, null, null, null, "spa" },
  778. { "0", "cero" },
  779. { "1", "uno" },
  780. { "2", "dos" },
  781. { "3", "tres" },
  782. { "4", "cuatro" },
  783. { "5", "cinco" },
  784. { "6", "seise" },
  785. { "7", "siete" },
  786. { "8", "ocho" },
  787. { "9", "nueve" },
  788. { "10", "diez" },
  789. { "11", "once" },
  790. { "12", "doce" },
  791. { "13", "trece" },
  792. { "14", "catorce" },
  793. { "15", "quince" },
  794. { "16", "diecis\u00e9is" },
  795. { "17", "diecisiete" },
  796. { "18", "dieciocho" },
  797. { "19", "diecinueve" },
  798. { "20", "veinte" },
  799. { "21", "veintiuno" },
  800. { "22", "veintid\u00f3s" },
  801. { "23", "veintitr\u00e9s" },
  802. { "24", "veinticuatro" },
  803. { "25", "veinticinco" },
  804. { "26", "veintis\u00e9is" },
  805. { "27", "veintisiete" },
  806. { "28", "veintiocho" },
  807. { "29", "veintinueve" },
  808. { "30", "treinta" },
  809. { "31", "treinta y uno" },
  810. { "32", "treinta y dos" },
  811. { "40", "cuarenta" },
  812. { "41", "cuarenta y uno" },
  813. { "42", "cuarenta y dos" },
  814. { "50", "cincuenta" },
  815. { "51", "cincuenta y uno" },
  816. { "52", "cincuenta y dos" },
  817. { "60", "sesenta" },
  818. { "61", "sesenta y uno" },
  819. { "62", "sesenta y dos" },
  820. { "70", "setenta" },
  821. { "71", "setenta y uno" },
  822. { "72", "setenta y dos" },
  823. { "80", "ochenta" },
  824. { "81", "ochenta y uno" },
  825. { "82", "ochenta y dos" },
  826. { "90", "noventa" },
  827. { "91", "noventa y uno" },
  828. { "92", "noventa y dos" },
  829. { "99", "noventa y nueve" },
  830. { "100", "cien" },
  831. { "101", "ciento uno" },
  832. { "102", "ciento dos" },
  833. { "200", "doscientos" },
  834. { "300", "trescientos" },
  835. { "400", "cuatrocientos" },
  836. { "500", "quinientos" },
  837. { "600", "seiscientos" },
  838. { "700", "setecientos" },
  839. { "800", "ochocientos" },
  840. { "900", "novecientos" },
  841. { "999", "novecientos noventa y nueve" },
  842. { "1000", "mil" },
  843. { "1001", "mil uno" },
  844. { "1002", "mil dos" },
  845. { "2000", "dos mil" },
  846. { "2001", "dos mil uno" },
  847. { "100000", "cien mil" },
  848. { "100001", "cien mil uno" },
  849. { "999999", "novecientos noventa y nueve mil novecientos noventa y nueve" },
  850. { "1000000", "un mill\u00f3n" },
  851. { "999999999", "novecientos noventa y nueve millones novecientos noventa y nueve mil novecientos noventa y nueve" },
  852. { "1000000000", "mil millones" }
  853. };
  854. private static String[][] formatWordSpanishUpper =
  855. {
  856. { "W", null, null, null, null, "spa" },
  857. { "0", "CERO" },
  858. { "1", "UNO" },
  859. { "2", "DOS" },
  860. { "3", "TRES" },
  861. { "4", "CUATRO" },
  862. { "5", "CINCO" },
  863. { "6", "SEISE" },
  864. { "7", "SIETE" },
  865. { "8", "OCHO" },
  866. { "9", "NUEVE" },
  867. { "10", "DIEZ" },
  868. { "11", "ONCE" },
  869. { "12", "DOCE" },
  870. { "13", "TRECE" },
  871. { "14", "CATORCE" },
  872. { "15", "QUINCE" },
  873. { "16", "DIECIS\u00c9IS" },
  874. { "17", "DIECISIETE" },
  875. { "18", "DIECIOCHO" },
  876. { "19", "DIECINUEVE" },
  877. { "20", "VEINTE" },
  878. { "21", "VEINTIUNO" },
  879. { "22", "VEINTID\u00d3S" },
  880. { "23", "VEINTITR\u00c9S" },
  881. { "24", "VEINTICUATRO" },
  882. { "25", "VEINTICINCO" },
  883. { "26", "VEINTIS\u00c9IS" },
  884. { "27", "VEINTISIETE" },
  885. { "28", "VEINTIOCHO" },
  886. { "29", "VEINTINUEVE" },
  887. { "30", "TREINTA" },
  888. { "31", "TREINTA Y UNO" },
  889. { "32", "TREINTA Y DOS" },
  890. { "40", "CUARENTA" },
  891. { "41", "CUARENTA Y UNO" },
  892. { "42", "CUARENTA Y DOS" },
  893. { "50", "CINCUENTA" },
  894. { "51", "CINCUENTA Y UNO" },
  895. { "52", "CINCUENTA Y DOS" },
  896. { "60", "SESENTA" },
  897. { "61", "SESENTA Y UNO" },
  898. { "62", "SESENTA Y DOS" },
  899. { "70", "SETENTA" },
  900. { "71", "SETENTA Y UNO" },
  901. { "72", "SETENTA Y DOS" },
  902. { "80", "OCHENTA" },
  903. { "81", "OCHENTA Y UNO" },
  904. { "82", "OCHENTA Y DOS" },
  905. { "90", "NOVENTA" },
  906. { "91", "NOVENTA Y UNO" },
  907. { "92", "NOVENTA Y DOS" },
  908. { "99", "NOVENTA Y NUEVE" },
  909. { "100", "CIEN" },
  910. { "101", "CIENTO UNO" },
  911. { "102", "CIENTO DOS" },
  912. { "200", "DOSCIENTOS" },
  913. { "300", "TRESCIENTOS" },
  914. { "400", "CUATROCIENTOS" },
  915. { "500", "QUINIENTOS" },
  916. { "600", "SEISCIENTOS" },
  917. { "700", "SETECIENTOS" },
  918. { "800", "OCHOCIENTOS" },
  919. { "900", "NOVECIENTOS" },
  920. { "999", "NOVECIENTOS NOVENTA Y NUEVE" },
  921. { "1000", "MIL" },
  922. { "1001", "MIL UNO" },
  923. { "1002", "MIL DOS" },
  924. { "2000", "DOS MIL" },
  925. { "2001", "DOS MIL UNO" },
  926. { "100000", "CIEN MIL" },
  927. { "100001", "CIEN MIL UNO" },
  928. { "999999", "NOVECIENTOS NOVENTA Y NUEVE MIL NOVECIENTOS NOVENTA Y NUEVE" },
  929. { "1000000", "UN MILL\u00d3N" },
  930. { "999999999", "NOVECIENTOS NOVENTA Y NUEVE MILLONES NOVECIENTOS NOVENTA Y NUEVE MIL NOVECIENTOS NOVENTA Y NUEVE" },
  931. { "1000000000", "MIL MILLONES" }
  932. };
  933. private static String[][] formatWordSpanishTitle =
  934. {
  935. { "Ww", null, null, null, null, "spa" },
  936. { "0", "Cero" },
  937. { "1", "Uno" },
  938. { "2", "Dos" },
  939. { "3", "Tres" },
  940. { "4", "Cuatro" },
  941. { "5", "Cinco" },
  942. { "6", "Seise" },
  943. { "7", "Siete" },
  944. { "8", "Ocho" },
  945. { "9", "Nueve" },
  946. { "10", "Diez" },
  947. { "11", "Once" },
  948. { "12", "Doce" },
  949. { "13", "Trece" },
  950. { "14", "Catorce" },
  951. { "15", "Quince" },
  952. { "16", "Diecis\u00e9is" },
  953. { "17", "Diecisiete" },
  954. { "18", "Dieciocho" },
  955. { "19", "Diecinueve" },
  956. { "20", "Veinte" },
  957. { "21", "Veintiuno" },
  958. { "22", "Veintid\u00f3s" },
  959. { "23", "Veintitr\u00e9s" },
  960. { "24", "Veinticuatro" },
  961. { "25", "Veinticinco" },
  962. { "26", "Veintis\u00e9is" },
  963. { "27", "Veintisiete" },
  964. { "28", "Veintiocho" },
  965. { "29", "Veintinueve" },
  966. { "30", "Treinta" },
  967. { "31", "Treinta Y Uno" },
  968. { "32", "Treinta Y Dos" },
  969. { "40", "Cuarenta" },
  970. { "41", "Cuarenta Y Uno" },
  971. { "42", "Cuarenta Y Dos" },
  972. { "50", "Cincuenta" },
  973. { "51", "Cincuenta Y Uno" },
  974. { "52", "Cincuenta Y Dos" },
  975. { "60", "Sesenta" },
  976. { "61", "Sesenta Y Uno" },
  977. { "62", "Sesenta Y Dos" },
  978. { "70", "Setenta" },
  979. { "71", "Setenta Y Uno" },
  980. { "72", "Setenta Y Dos" },
  981. { "80", "Ochenta" },
  982. { "81", "Ochenta Y Uno" },
  983. { "82", "Ochenta Y Dos" },
  984. { "90", "Noventa" },
  985. { "91", "Noventa Y Uno" },
  986. { "92", "Noventa Y Dos" },
  987. { "99", "Noventa Y Nueve" },
  988. { "100", "Cien" },
  989. { "101", "Ciento Uno" },
  990. { "102", "Ciento Dos" },
  991. { "200", "Doscientos" },
  992. { "300", "Trescientos" },
  993. { "400", "Cuatrocientos" },
  994. { "500", "Quinientos" },
  995. { "600", "Seiscientos" },
  996. { "700", "Setecientos" },
  997. { "800", "Ochocientos" },
  998. { "900", "Novecientos" },
  999. { "999", "Novecientos Noventa Y Nueve" },
  1000. { "1000", "Mil" },
  1001. { "1001", "Mil Uno" },
  1002. { "1002", "Mil Dos" },
  1003. { "2000", "Dos Mil" },
  1004. { "2001", "Dos Mil Uno" },
  1005. { "100000", "Cien Mil" },
  1006. { "100001", "Cien Mil Uno" },
  1007. { "999999", "Novecientos Noventa Y Nueve Mil Novecientos Noventa Y Nueve" },
  1008. { "1000000", "Un Mill\u00f3n" },
  1009. { "999999999", "Novecientos Noventa Y Nueve Millones Novecientos Noventa Y Nueve Mil Novecientos Noventa Y Nueve" },
  1010. { "1000000000", "Mil Millones" }
  1011. };
  1012. private static String[][] formatWordFrenchLower =
  1013. {
  1014. { "w", null, null, null, null, "fra" },
  1015. { "0", "z\u00e9ro" },
  1016. { "1", "un" },
  1017. { "2", "deux" },
  1018. { "3", "trois" },
  1019. { "4", "quatre" },
  1020. { "5", "cinq" },
  1021. { "6", "six" },
  1022. { "7", "sept" },
  1023. { "8", "huit" },
  1024. { "9", "neuf" },
  1025. { "10", "dix" },
  1026. { "11", "onze" },
  1027. { "12", "douze" },
  1028. { "13", "treize" },
  1029. { "14", "quatorze" },
  1030. { "15", "quinze" },
  1031. { "16", "seize" },
  1032. { "17", "dix-sept" },
  1033. { "18", "dix-huit" },
  1034. { "19", "dix-neuf" },
  1035. { "20", "vingt" },
  1036. { "21", "vingt et un" },
  1037. { "22", "vingt-deux" },
  1038. { "23", "vingt-trois" },
  1039. { "24", "vingt-quatre" },
  1040. { "25", "vingt-cinq" },
  1041. { "26", "vingt-six" },
  1042. { "27", "vingt-sept" },
  1043. { "28", "vingt-huit" },
  1044. { "29", "vingt-neuf" },
  1045. { "30", "trente" },
  1046. { "31", "trente et un" },
  1047. { "32", "trente-deux" },
  1048. { "40", "quarante" },
  1049. { "41", "quarante et un" },
  1050. { "42", "quarante-deux" },
  1051. { "50", "cinquante" },
  1052. { "51", "cinquante et un" },
  1053. { "52", "cinquante-deux" },
  1054. { "60", "soixante" },
  1055. { "61", "soixante et un" },
  1056. { "62", "soixante-deux" },
  1057. { "70", "soixante-dix" },
  1058. { "71", "soixante et onze" },
  1059. { "72", "soixante-douze" },
  1060. { "79", "soixante-dix-neuf" },
  1061. { "80", "quatre-vingts" },
  1062. { "81", "quatre-vingt-un" },
  1063. { "82", "quatre-vingt-deux" },
  1064. { "89", "quatre-vingt-neuf" },
  1065. { "90", "quatre-vingt-dix" },
  1066. { "91", "quatre-vingt-onze" },
  1067. { "92", "quatre-vingt-douze" },
  1068. { "99", "quatre-vingt-dix-neuf" },
  1069. { "100", "cent" },
  1070. { "101", "cent un" },
  1071. { "102", "cent deux" },
  1072. { "200", "deux cents" },
  1073. { "201", "deux cent un" },
  1074. { "202", "deux cent deux" },
  1075. { "300", "trois cents" },
  1076. { "301", "trois cent un" },
  1077. { "400", "quatre cents" },
  1078. { "401", "quatre cent un" },
  1079. { "500", "cinq cents" },
  1080. { "501", "cinq cent un" },
  1081. { "600", "six cents" },
  1082. { "601", "six cent un" },
  1083. { "700", "sept cents" },
  1084. { "701", "sept cent un" },
  1085. { "800", "huit cents" },
  1086. { "801", "huit cent un" },
  1087. { "900", "neuf cents" },
  1088. { "901", "neuf cent un" },
  1089. { "999", "neuf cent quatre-vingt-dix-neuf" },
  1090. { "1000", "mille" },
  1091. { "1001", "mille un" },
  1092. { "1002", "mille deux" },
  1093. { "2000", "deux mille" },
  1094. { "2001", "deux mille un" },
  1095. { "100000", "cent mille" },
  1096. { "100001", "cent mille un" },
  1097. { "999999", "neuf cent quatre-vingt-dix-neuf mille neuf cent quatre-vingt-dix-neuf" },
  1098. { "1000000", "un million" },
  1099. { "999999999", "neuf cent quatre-vingt-dix-neuf millions neuf cent quatre-vingt-dix-neuf mille neuf cent quatre-vingt-dix-neuf" },
  1100. { "1000000000", "un milliard" }
  1101. };
  1102. private static String[][] formatWordFrenchUpper =
  1103. {
  1104. { "W", null, null, null, null, "fra" },
  1105. { "0", "Z\u00c9RO" },
  1106. { "1", "UN" },
  1107. { "2", "DEUX" },
  1108. { "3", "TROIS" },
  1109. { "4", "QUATRE" },
  1110. { "5", "CINQ" },
  1111. { "6", "SIX" },
  1112. { "7", "SEPT" },
  1113. { "8", "HUIT" },
  1114. { "9", "NEUF" },
  1115. { "10", "DIX" },
  1116. { "11", "ONZE" },
  1117. { "12", "DOUZE" },
  1118. { "13", "TREIZE" },
  1119. { "14", "QUATORZE" },
  1120. { "15", "QUINZE" },
  1121. { "16", "SEIZE" },
  1122. { "17", "DIX-SEPT" },
  1123. { "18", "DIX-HUIT" },
  1124. { "19", "DIX-NEUF" },
  1125. { "20", "VINGT" },
  1126. { "21", "VINGT ET UN" },
  1127. { "22", "VINGT-DEUX" },
  1128. { "23", "VINGT-TROIS" },
  1129. { "24", "VINGT-QUATRE" },
  1130. { "25", "VINGT-CINQ" },
  1131. { "26", "VINGT-SIX" },
  1132. { "27", "VINGT-SEPT" },
  1133. { "28", "VINGT-HUIT" },
  1134. { "29", "VINGT-NEUF" },
  1135. { "30", "TRENTE" },
  1136. { "31", "TRENTE ET UN" },
  1137. { "32", "TRENTE-DEUX" },
  1138. { "40", "QUARANTE" },
  1139. { "41", "QUARANTE ET UN" },
  1140. { "42", "QUARANTE-DEUX" },
  1141. { "50", "CINQUANTE" },
  1142. { "51", "CINQUANTE ET UN" },
  1143. { "52", "CINQUANTE-DEUX" },
  1144. { "60", "SOIXANTE" },
  1145. { "61", "SOIXANTE ET UN" },
  1146. { "62", "SOIXANTE-DEUX" },
  1147. { "70", "SOIXANTE-DIX" },
  1148. { "71", "SOIXANTE ET ONZE" },
  1149. { "72", "SOIXANTE-DOUZE" },
  1150. { "79", "SOIXANTE-DIX-NEUF" },
  1151. { "80", "QUATRE-VINGTS" },
  1152. { "81", "QUATRE-VINGT-UN" },
  1153. { "82", "QUATRE-VINGT-DEUX" },
  1154. { "89", "QUATRE-VINGT-NEUF" },
  1155. { "90", "QUATRE-VINGT-DIX" },
  1156. { "91", "QUATRE-VINGT-ONZE" },
  1157. { "92", "QUATRE-VINGT-DOUZE" },
  1158. { "99", "QUATRE-VINGT-DIX-NEUF" },
  1159. { "100", "CENT" },
  1160. { "101", "CENT UN" },
  1161. { "102", "CENT DEUX" },
  1162. { "200", "DEUX CENTS" },
  1163. { "201", "DEUX CENT UN" },
  1164. { "202", "DEUX CENT DEUX" },
  1165. { "300", "TROIS CENTS" },
  1166. { "301", "TROIS CENT UN" },
  1167. { "400", "QUATRE CENTS" },
  1168. { "401", "QUATRE CENT UN" },
  1169. { "500", "CINQ CENTS" },
  1170. { "501", "CINQ CENT UN" },
  1171. { "600", "SIX CENTS" },
  1172. { "601", "SIX CENT UN" },
  1173. { "700", "SEPT CENTS" },
  1174. { "701", "SEPT CENT UN" },
  1175. { "800", "HUIT CENTS" },
  1176. { "801", "HUIT CENT UN" },
  1177. { "900", "NEUF CENTS" },
  1178. { "901", "NEUF CENT UN" },
  1179. { "999", "NEUF CENT QUATRE-VINGT-DIX-NEUF" },
  1180. { "1000", "MILLE" },
  1181. { "1001", "MILLE UN" },
  1182. { "1002", "MILLE DEUX" },
  1183. { "2000", "DEUX MILLE" },
  1184. { "2001", "DEUX MILLE UN" },
  1185. { "100000", "CENT MILLE" },
  1186. { "100001", "CENT MILLE UN" },
  1187. { "999999", "NEUF CENT QUATRE-VINGT-DIX-NEUF MILLE NEUF CENT QUATRE-VINGT-DIX-NEUF" },
  1188. { "1000000", "UN MILLION" },
  1189. { "999999999", "NEUF CENT QUATRE-VINGT-DIX-NEUF MILLIONS NEUF CENT QUATRE-VINGT-DIX-NEUF MILLE NEUF CENT QUATRE-VINGT-DIX-NEUF" },
  1190. { "1000000000", "UN MILLIARD" }
  1191. };
  1192. private static String[][] formatWordFrenchTitle =
  1193. {
  1194. { "Ww", null, null, null, null, "fra" },
  1195. { "0", "Z\u00e9ro" },
  1196. { "1", "Un" },
  1197. { "2", "Deux" },
  1198. { "3", "Trois" },
  1199. { "4", "Quatre" },
  1200. { "5", "Cinq" },
  1201. { "6", "Six" },
  1202. { "7", "Sept" },
  1203. { "8", "Huit" },
  1204. { "9", "Neuf" },
  1205. { "10", "Dix" },
  1206. { "11", "Onze" },
  1207. { "12", "Douze" },
  1208. { "13", "Treize" },
  1209. { "14", "Quatorze" },
  1210. { "15", "Quinze" },
  1211. { "16", "Seize" },
  1212. { "17", "Dix-sept" },
  1213. { "18", "Dix-huit" },
  1214. { "19", "Dix-neuf" },
  1215. { "20", "Vingt" },
  1216. { "21", "Vingt Et Un" },
  1217. { "22", "Vingt-deux" },
  1218. { "23", "Vingt-trois" },
  1219. { "24", "Vingt-quatre" },
  1220. { "25", "Vingt-cinq" },
  1221. { "26", "Vingt-six" },
  1222. { "27", "Vingt-sept" },
  1223. { "28", "Vingt-huit" },
  1224. { "29", "Vingt-neuf" },
  1225. { "30", "Trente" },
  1226. { "31", "Trente Et Un" },
  1227. { "32", "Trente-deux" },
  1228. { "40", "Quarante" },
  1229. { "41", "Quarante Et Un" },
  1230. { "42", "Quarante-deux" },
  1231. { "50", "Cinquante" },
  1232. { "51", "Cinquante Et Un" },
  1233. { "52", "Cinquante-deux" },
  1234. { "60", "Soixante" },
  1235. { "61", "Soixante Et Un" },
  1236. { "62", "Soixante-deux" },
  1237. { "70", "Soixante-dix" },
  1238. { "71", "Soixante Et Onze" },
  1239. { "72", "Soixante-douze" },
  1240. { "79", "Soixante-dix-neuf" },
  1241. { "80", "Quatre-vingts" },
  1242. { "81", "Quatre-vingt-un" },
  1243. { "82", "Quatre-vingt-deux" },
  1244. { "89", "Quatre-vingt-neuf" },
  1245. { "90", "Quatre-vingt-dix" },
  1246. { "91", "Quatre-vingt-onze" },
  1247. { "92", "Quatre-vingt-douze" },
  1248. { "99", "Quatre-vingt-dix-neuf" },
  1249. { "100", "Cent" },
  1250. { "101", "Cent Un" },
  1251. { "102", "Cent Deux" },
  1252. { "200", "Deux Cents" },
  1253. { "201", "Deux Cent Un" },
  1254. { "202", "Deux Cent Deux" },
  1255. { "300", "Trois Cents" },
  1256. { "301", "Trois Cent Un" },
  1257. { "400", "Quatre Cents" },
  1258. { "401", "Quatre Cent Un" },
  1259. { "500", "Cinq Cents" },
  1260. { "501", "Cinq Cent Un" },
  1261. { "600", "Six Cents" },
  1262. { "601", "Six Cent Un" },
  1263. { "700", "Sept Cents" },
  1264. { "701", "Sept Cent Un" },
  1265. { "800", "Huit Cents" },
  1266. { "801", "Huit Cent Un" },
  1267. { "900", "Neuf Cents" },
  1268. { "901", "Neuf Cent Un" },
  1269. { "999", "Neuf Cent Quatre-vingt-dix-neuf" },
  1270. { "1000", "Mille" },
  1271. { "1001", "Mille Un" },
  1272. { "1002", "Mille Deux" },
  1273. { "2000", "Deux Mille" },
  1274. { "2001", "Deux Mille Un" },
  1275. { "100000", "Cent Mille" },
  1276. { "100001", "Cent Mille Un" },
  1277. { "999999", "Neuf Cent Quatre-vingt-dix-neuf Mille Neuf Cent Quatre-vingt-dix-neuf" },
  1278. { "1000000", "Un Million" },
  1279. { "999999999", "Neuf Cent Quatre-vingt-dix-neuf Millions Neuf Cent Quatre-vingt-dix-neuf Mille Neuf Cent Quatre-vingt-dix-neuf" },
  1280. { "1000000000", "Un Milliard" }
  1281. };
  1282. /**
  1283. * Tests decimal from latin script.
  1284. * @throws Exception if the test fails
  1285. */
  1286. @Test
  1287. public void testFormatDecimal() throws Exception {
  1288. performConversions(formatDecimal);
  1289. performConversions(formatDecimalPadded);
  1290. performConversions(formatDecimalGrouped);
  1291. performConversions(formatDecimalGroupedPadded);
  1292. }
  1293. /**
  1294. * Tests decimal from arabic script.
  1295. * @throws Exception if the test fails
  1296. */
  1297. @Test
  1298. public void testFormatDecimalArabic() throws Exception {
  1299. performConversions(formatDecimalArabic);
  1300. performConversions(formatDecimalArabicPadded);
  1301. performConversions(formatDecimalArabicGrouped);
  1302. performConversions(formatDecimalArabicGroupedPadded);
  1303. }
  1304. /**
  1305. * Tests decimal from thai script.
  1306. * @throws Exception if the test fails
  1307. */
  1308. @Test
  1309. public void testFormatDecimalThai() throws Exception {
  1310. performConversions(formatDecimalThai);
  1311. performConversions(formatDecimalThaiPadded);
  1312. }
  1313. /**
  1314. * Tests roman numbers.
  1315. * @throws Exception if the test fails
  1316. */
  1317. @Test
  1318. public void testFormatRoman() throws Exception {
  1319. performConversions(formatRomanLower);
  1320. performConversions(formatRomanUpper);
  1321. performConversions(formatRomanLargeLower);
  1322. performConversions(formatRomanLargeUpper);
  1323. performConversions(formatRomanNumberFormsLower);
  1324. performConversions(formatRomanNumberFormsUpper);
  1325. }
  1326. /**
  1327. * Tests latin alphabetic sequence numerals.
  1328. * @throws Exception if the test fails
  1329. */
  1330. @Test
  1331. public void testAlphabeticLatin() throws Exception {
  1332. performConversions(formatAlphabeticLatinLower);
  1333. performConversions(formatAlphabeticLatinUpper);
  1334. }
  1335. /**
  1336. * Tests arabic alphabetic sequence numerals.
  1337. * @throws Exception if the test fails
  1338. */
  1339. @Test
  1340. public void testAlphabeticArabic() throws Exception {
  1341. performConversions(formatAlphabeticArabicHijai);
  1342. performConversions(formatAlphabeticArabicAbjadi);
  1343. }
  1344. /**
  1345. * Tests hebrew alphabetic sequence numerals.
  1346. * @throws Exception if the test fails
  1347. */
  1348. @Test
  1349. public void testAlphabeticHebrew() throws Exception {
  1350. performConversions(formatAlphabeticHebrew);
  1351. }
  1352. /**
  1353. * Tests latin alphabetic sequence numerals.
  1354. * @throws Exception if the test fails
  1355. */
  1356. @Test
  1357. public void testAlphabeticThai() throws Exception {
  1358. performConversions(formatAlphabeticThai);
  1359. }
  1360. /**
  1361. * Tests arabic numerals..
  1362. * @throws Exception if the test fails
  1363. */
  1364. @Test
  1365. public void testNumeralArabic() throws Exception {
  1366. performConversions(formatNumeralArabicAbjadi);
  1367. }
  1368. /**
  1369. * Tests hebrew numerals.
  1370. * @throws Exception if the test fails
  1371. */
  1372. @Test
  1373. public void testNumeralHebrew() throws Exception {
  1374. performConversions(formatNumeralHebrewGematria);
  1375. }
  1376. /**
  1377. * Tests english word numerals.
  1378. * @throws Exception if the test fails
  1379. */
  1380. @Test
  1381. public void testWordEnglish() throws Exception {
  1382. performConversions(formatWordEnglishLower);
  1383. performConversions(formatWordEnglishUpper);
  1384. performConversions(formatWordEnglishTitle);
  1385. }
  1386. /**
  1387. * Tests spanish word numerals.
  1388. * @throws Exception if the test fails
  1389. */
  1390. @Test
  1391. public void testWordSpanish() throws Exception {
  1392. performConversions(formatWordSpanishLower);
  1393. performConversions(formatWordSpanishUpper);
  1394. performConversions(formatWordSpanishTitle);
  1395. }
  1396. /**
  1397. * Tests french word numerals.
  1398. * @throws Exception if the test fails
  1399. */
  1400. @Test
  1401. public void testWordFrench() throws Exception {
  1402. performConversions(formatWordFrenchLower);
  1403. performConversions(formatWordFrenchUpper);
  1404. performConversions(formatWordFrenchTitle);
  1405. }
  1406. /**
  1407. * Perform conversions according to test specification.
  1408. * @param ts test specification
  1409. */
  1410. private void performConversions(String[][] ts) {
  1411. assert ts != null;
  1412. assert ts.length >= 2;
  1413. String[] args = ts[0];
  1414. assert args != null;
  1415. assert args.length > 0;
  1416. String format = args[0];
  1417. assert format.length() > 0;
  1418. char groupingSeparator;
  1419. if (args.length > 1) {
  1420. String s = args[1];
  1421. if ((s != null) && (s.length() > 0)) {
  1422. groupingSeparator = s.charAt(0);
  1423. } else {
  1424. groupingSeparator = 0;
  1425. }
  1426. } else {
  1427. groupingSeparator = 0;
  1428. }
  1429. int groupingSize;
  1430. if (args.length > 2) {
  1431. String s = args[2];
  1432. if ((s != null) && (s.length() > 0)) {
  1433. groupingSize = Integer.parseInt(s);
  1434. } else {
  1435. groupingSize = 0;
  1436. }
  1437. } else {
  1438. groupingSize = 0;
  1439. }
  1440. int letterValue;
  1441. if (args.length > 3) {
  1442. String s = args[3];
  1443. if ((s != null) && (s.length() > 0)) {
  1444. s = s.toLowerCase();
  1445. if (s.equals("alphabetic")) {
  1446. letterValue = NumberConverter.LETTER_VALUE_ALPHABETIC;
  1447. } else if (s.equals("traditional")) {
  1448. letterValue = NumberConverter.LETTER_VALUE_TRADITIONAL;
  1449. } else {
  1450. letterValue = 0;
  1451. }
  1452. } else {
  1453. letterValue = 0;
  1454. }
  1455. } else {
  1456. letterValue = 0;
  1457. }
  1458. String features;
  1459. if (args.length > 4) {
  1460. String s = args[4];
  1461. if ((s != null) && (s.length() > 0)) {
  1462. features = s;
  1463. } else {
  1464. features = null;
  1465. }
  1466. } else {
  1467. features = null;
  1468. }
  1469. String language;
  1470. if (args.length > 5) {
  1471. String s = args[5];
  1472. if ((s != null) && (s.length() > 0)) {
  1473. language = s;
  1474. } else {
  1475. language = null;
  1476. }
  1477. } else {
  1478. language = null;
  1479. }
  1480. String country;
  1481. if (args.length > 6) {
  1482. String s = args[6];
  1483. if ((s != null) && (s.length() > 0)) {
  1484. country = s;
  1485. } else {
  1486. country = null;
  1487. }
  1488. } else {
  1489. country = null;
  1490. }
  1491. NumberConverter nc = new NumberConverter(format, groupingSeparator, groupingSize, letterValue, features, language, country);
  1492. for (int i = 1, nt = ts.length; i < nt; i++) {
  1493. String[] sa = ts[i];
  1494. assert sa != null;
  1495. assert sa.length >= 2;
  1496. List<Long> numbers = new ArrayList<Long>();
  1497. for (int k = 0, nn = sa.length - 1; k < nn; k++) {
  1498. String s = sa[k];
  1499. numbers.add(Long.valueOf(s));
  1500. }
  1501. String expected = sa [ sa.length - 1 ];
  1502. String actual = nc.convert(numbers);
  1503. assertEquals(expected, actual);
  1504. }
  1505. }
  1506. }