tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,38 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols nobinary
|
||||
|
||||
import java.util.Formatter
|
||||
|
||||
loop i_ = 1 to 3
|
||||
loop n_ = 20 to 20000 by 2131
|
||||
select case i_
|
||||
when 1 then say useBif(n_)
|
||||
when 2 then say useJavaFormat(n_)
|
||||
when 3 then say useJavaNumber(n_)
|
||||
otherwise nop
|
||||
end
|
||||
end n_
|
||||
say
|
||||
end i_
|
||||
|
||||
return
|
||||
|
||||
-- NetRexx doesn't have a decimal to octal conversion
|
||||
method useBif(n_) public static
|
||||
d_ = '_'
|
||||
return '[Base 16='n_.d2x().right(8)',Base 10='n_.right(8)',Base 8='d_.right(8)',Base 2='n_.d2x().x2b().right(20)']'
|
||||
|
||||
-- Some of Java's java.lang.Number classes have conversion methods
|
||||
method useJavaNumber(n_) public static
|
||||
nx = Long.toHexString(n_)
|
||||
nd = Long.toString(n_)
|
||||
no = Long.toOctalString(n_)
|
||||
nb = Long.toBinaryString(n_)
|
||||
return '[Base 16='Rexx(nx).right(8)',Base 10='Rexx(nd).right(8)',Base 8='Rexx(no).right(8)',Base 2='Rexx(nb).right(20)']'
|
||||
|
||||
-- Java Formatter doesn't have a decimal to binary conversion
|
||||
method useJavaFormat(n_) public static
|
||||
fb = StringBuilder()
|
||||
fm = Formatter(fb)
|
||||
fm.format("[Base 16=%1$8x,Base 10=%1$8d,Base 8=%1$8o,Base 2=%2$20s]", [Object Long(n_), String('_')])
|
||||
return fb.toString()
|
||||
Loading…
Add table
Add a link
Reference in a new issue