Created
October 18, 2012 07:36
-
-
Save bamthomas/3910307 to your computer and use it in GitHub Desktop.
Bascule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int calculepalier(StringBuffer buffer, int chiffre, Chiffre chiffreCourant, Chiffre precedent) { | |
int nombrePalier = chiffre / chiffreCourant.chiffreArabe; | |
for (int i = 0; i < nombrePalier; i++) { | |
if (chiffre >= chiffreCourant.chiffreArabe) { | |
buffer.append(chiffreCourant.name()); | |
chiffre -= chiffreCourant.chiffreArabe; | |
} | |
} | |
if (chiffre == chiffreCourant.chiffreArabe - precedent.chiffreArabe) { | |
buffer.append(precedent.name()); | |
chiffre += precedent.chiffreArabe; | |
} | |
nombrePalier = chiffre / chiffreCourant.chiffreArabe; | |
for (int i = 0; i < nombrePalier; i++) { | |
if (chiffre >= chiffreCourant.chiffreArabe) { | |
buffer.append(chiffreCourant.name()); | |
chiffre -= chiffreCourant.chiffreArabe; | |
} | |
} | |
return chiffre; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int calculepalier(StringBuffer buffer, int chiffre, Chiffre chiffreCourant, Chiffre precedent) { | |
int nombrePalier = chiffre / chiffreCourant.chiffreArabe; | |
for (int i = 0; i < nombrePalier; i++) { | |
buffer.append(chiffreCourant.name()); | |
chiffre -= chiffreCourant.chiffreArabe; | |
} | |
if (chiffre == chiffreCourant.chiffreArabe - precedent.chiffreArabe) { | |
buffer.append(precedent.name()); | |
chiffre += precedent.chiffreArabe; | |
buffer.append(chiffreCourant.name()); | |
chiffre -= chiffreCourant.chiffreArabe; | |
} | |
return chiffre; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment