---
title: "数字转人民币算法"
author: "dmwdmc"
date: "2013-06-04T09:53:27Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2013-06-04T09:53:27Z"
id: 1881886
url: "https://dmwdmc.iteye.com/blog/1881886"
---

```java

public class RMBTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String []A=new String[10];
			A[0]="零";
			A[1]="壹";
			A[2]="贰";
			A[3]="叁";
			A[4]="肆";
			A[5]="伍";
			A[6]="陆";
			A[7]="柒";
			A[8]="捌";
			A[9]="玖";
		String []B=new String[10];
			B[0]="";
			B[1]="拾";
			B[2]="佰";
			B[3]="仟";
			B[4]="万";
			B[5]="拾";
			B[6]="佰";
			B[7]="仟";
			B[8]="亿";
	   String number="768768768";
	   for(int i=0;i<number.length();i++){
		   int v=Integer.parseInt(number.charAt(i)+"");
		   int k=number.length()-1-i;
		   System.out.print(A[v]+B[k]);
	   }
	 
	}

}

```